I have a configurable product from which I am trying to get reviews


 * Product view template
 * @see Mage_Catalog_Block_Product_View
 * @see Mage_Review_Block_Product_View

$_product = $this->getProduct();

I need ratings in a group count of 5 star, 4 star, 3 star, 2 star and 1 star. like this

enter image description here

I have done the following, by going through this link (check @sinclairfr's post), which is giving me complete html of ratings related to the product.

<?php $zoo = new Mage_Rating_Block_Entity_Detailed(); ?>
<?php echo $zoo->toHtml(); ?>

and also this

$review = Mage::getModel('review/review');
$collection = $review->getProductCollection();
->addFieldToFilter('product_id', $_product->getId());


By going through this link

still no use


You can get all the votes attached to a product with the following code. Note that the setEntityPkFilter is setting the product id.

$votesCollection = Mage::getModel('rating/rating_option_vote')

This will give you each type of vote. So in the default shop you will get three items in this collection per review. The ratings are done on price, quality and value.

You could then loop through each of the items in the collection and add them to the star rating. The sample data of a vote item is:

array(10) {
  string(3) "283"
  string(1) "9"
  string(9) ""
  string(10) "2130706433"
  string(2) "27"
  string(1) "2"
  string(2) "95"
  string(2) "80"
  string(1) "4"
| improve this answer | |
  • how will you filter these rating on the basis of approved or pending review? – Akash Mar 28 '16 at 19:09

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.