0

How can I display all the reviews of the products on a single CMS page? I have found a module: http://www.magentocommerce.com/magento-connect/all-reviews.html, but it is nog compatible with 1.9.

enter image description here

mckbgrd
  • 1
  • 4

3 Answers3

1

Step1: You can get review Collection by below code:

$Collection=Mage::getModel('review/review')->getCollection()
                ->addStoreFilter(Mage::app()->getStore()->getId())
                ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
                ->addRateVotes()
                ->setDateOrder();

Step2: Create a Cms page from admin>Cms>Page> and at Design tab and put this code

<reference name="content">
<block type="core/template" name="review.form" template="catalog/allreview.phtml"/>
</reference>   

Step3: create allreview.phtml on app/design/frontend/your package/your template/templete/catalog/ and put below this phtml file you can put review details by below code:

<?php
    $_items = array_reverse( $Collection->getItems());

    foreach ($_items as $_review):
        $productId =  $_review->getentity_pk_value();
         $_review->getTitle();
         $_votes = $_review->getRatingVotes();
         $_review->getDetail()
          $this->formatDate($_review->getCreatedAt()) ?>
              $this->__('[Posted %s]', $this->formatDate($_review->getCreatedAt()), 'long');

    endforeach;
?>
Amit Bera
  • 77,456
  • 20
  • 123
  • 237
0

in your magento backend system-perssions-blocks click "add new block" create a new block name "allreviews/allreviews" set allowed that will slove this problem

mymyhope
  • 1
  • 1
0

Call a phtml file in cms page and call below code in the phtml file:

$_reviews = Mage::getModel('review/review')
->getResourceCollection()
->addStoreFilter(Mage::app()->getStore()->getId())
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
->setDateOrder()
->addRateVotes();
foreach($_reviews as $review){
// load the product for the corresponding review if You need to display product information
$product = Mage::getModel('catalog/product')->load($review->getData('entity_pk_value'));
$j=0;
$cumulative = 0;
foreach( $review->getRatingVotes() as $vote ) {
$cumulative +=$vote->getPercent();
$j++;
}
$finalPercentage = 0;
if ($cumulative != 0){
$finalPercentage = ($cumulative/$j);
}
}//close the foreach
?>

Please let me know if you have any questions.

Mohit Kumar Arora
  • 9,951
  • 7
  • 27
  • 55