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

1
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;
?>
13
  • But what I have to do at step 1? Step 2 and 3 are done, but the page on the frontend is showing the code from step 3. – mckbgrd Nov 12 '14 at 10:32
  • please ckd... i have update – Amit Bera Nov 12 '14 at 10:33
  • I still get a screen with the code of step 3.. – mckbgrd Nov 12 '14 at 10:53
  • can you post the screen shot... – Amit Bera Nov 12 '14 at 11:04
  • You can see it in my question – mckbgrd Nov 12 '14 at 11:44
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

1
  • perssions.....? – 7ochem Apr 4 '16 at 15:27
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.