Possible solution:
Here is how you can retrieve all the comments.
Create a new php file on the same level as index.php of Magento. let's call it reviews.php
the content of this file should look like this:
<?php $mageFilename = 'app/Mage.php'; require_once $mageFilename; Varien_Profiler::enable(); Mage::setIsDeveloperMode(true); ini_set('display_errors', 1); umask(0); Mage::app('default'); Mage::register('isSecureArea', 1); header('Content-Type: text/xml; charset=utf-8'); echo "<?xml version =\"1.0\" encoding =\"UTF-8\"?>\n"; echo "<reviews>\n"; $collection = Mage::getModel('review/review')->getCollection(); foreach ($collection as $item){ $review = Mage::getModel('review/review')->load($item->getId()); echo "\t<review>\n"; echo "\t\t<id>".$review->getId()."</id>\n"; echo "\t\t<created_at>".$review->getCreatedAt()."</created_at>\n"; echo "\t\t<status_id>".$review->getStatusId()."</status_id>\n"; echo "\t\t<store_id>".$review->getStoreId()."</store_id>\n"; echo "\t\t<title>".$review->getTitle()."</title>\n"; echo "\t\t<detail>".$review->getDetail()."</detail>\n"; echo "\t\t<nickname>".$review->getNickname()."</nickname>\n"; echo "\t\t<customer_id>".$review->getCustomerId()."</customer_id>\n"; echo "\t\t<product_id>".$review->getEntityPkValue()."</product_id>\n"; echo "\t\t<stores>".implode(",", $review->getStores())."</stores>\n"; echo "\t</review>\n"; } echo "</reviews>"; ?>Just call the page in your browser (www.yoursite.com/review.php)
This will export all the reviews in xml format. If you want an other format you can manage from this.
The status id is one of these
APPROVED = 1; PENDING = 2; NOT_APPROVED = 3;
I hope this helps.
No comments:
Post a Comment