Saturday 30 January 2016

How to get Review/Rating summary in Magento

We can use the below code to retrieve product Review/Rating summary in Magento



<?php 


$product = Mage::getModel('catalog/product')->load($productId);


$storeId    = Mage::app()->getStore()->getId();


$summaryReview = Mage::getModel('review/review_summary')
  ->setStoreId($storeId)
  ->load('product_id');


  if($summaryReview->getRatingSummary()){


  ?>


  <div class="rating-box" style="float:left;">


<div class="rating" style="width: <?php echo $summaryData->getRatingSummary().'%'; ?>">

                             </div>
  </div>
<?php 
}
?>

7 comments:

  1. Its a very nice post about the significances of Magento. Its really useful. Thanks for posting, Keep updating.
    gemstone shop in south Delhi

    ReplyDelete
  2. Pretty nice blog and very well maintained. Good to know about magento rewriting summary. Really appreciated. Keep updating your post.
    Color Coated Profile Sheets In Loha Mandi Naraina: VIMP

    ReplyDelete
  3. Very informative post and pretty well maintained, this post is very important for the Magento Developer. Thanks for posting and keep updating your post.
    vitamin c gel face wash

    ReplyDelete