Here at Inchoo, we are working on a private project, that should see daylight any time soon. One of the requirements we had is to show product review info on pages independent of product review page. Let’s say you wish to show review info on home page for some of the products. After few weeks with working with Magento, one learns how to use the model stuff directly from view files. Although this might not be the “right” way, it’s most definitely the fastest way (and I doubt most of your clients would prefer any other
, especially if it’s some minor modification).
Here is a code to retrieve the product review info:
<?php
$storeId = Mage::app()->getStore()->getId();
$summaryData = Mage::getModel(‘review/review_summary’)
->setStoreId($storeId)
->load($_product->getId());
/* @var $summaryData Mage_Review_Model_Review_Summary */
/*
array(
['primary_id'] => 147
['entity_pk_value'] => 166
['entity_type'] => 1
['reviews_count'] => 1
['rating_summary'] => 80
['store_id'] => 1
)
*/
?>
Just be sure to pass it the right product id number. Cheers…



where do i have to insert this code ?
How do you echo out the rating summary as the ’5 stars’ using this method?
As always, answered by own question just after I posted!
$storeId = Mage::app()->getStore()->getId();
$summaryData = Mage::getModel(‘review/review_summary’)
->setStoreId($storeId)
->load($_product->getId());
echo ‘
getRatingSummary().’%”>
‘;
As always, you at Inchoo provide kick-ass Magentutorials
i was to open a review page on my e commerce site and put a new product on the spotlight for customers to review / or just add the current data from the product page
where do i insert this code? i tried via the CMS but it’s not working
any suggestions ?
Please provide the solution..Thanks in Advance.
How to display Recent Review on my home page?
how do i add a product review pagination?
getStore()->getId();
$summaryData = Mage::getModel(‘review/review_summary’)
->setStoreId($storeId)
->load($_product->getId())->getRatingSummary();
?>
Get stare rating summary
But how to get star rating for each individual review ??
As always answered my own question
$reviewcollection = Mage::getModel('review/review')->getCollection() ->addStoreFilter(Mage::app()->getStore()->getId()) ->addStatusFilter('approved') ->addRateVotes() ->addEntityFilter('product', $this->getProduct()->getId()) ->setDateOrder();* added ->addRateVotes()
hi,
Any one please tell me the pagination for the reviews in front end…
Hi, now i doing select all products that have review highest, or vote % highest, but when select with ->join, magento generate sql statement ok, but collection not ok. More detail, i need order by rating_summary but collection products order by entity_id. Actual i don’t understand. This is my code:
$collection = Mage::getModel('catalog/product') ->getResourceCollection() ->addAttributeToSelect('*') ->setOrder('rating_summary', 'desc') ->setPageSize($this->getLimit()) ->load() ; $collection->getSelect() ->join(array('res'=>'review_entity_summary'), 'res.entity_pk_value = e.entity_id', array('res.rating_summary')); $collection->getSelect()->where('store_id ='.$this->getStore()) ; $collection->getSelect()->order('res.rating_summary desc');Hope for soon reply. Thank
i want to display reviews of new product on home page? please tell me where to put this code?…
@Harita, if you get an answer, let me know. Thanks
I’m getting a blank page when using the code from this post. Is there anything i’m missing?
This is really good. I was using this information about getting the reviews several times so far. Thank you
Hi there, where this code should be added?, i get a blank page when i used this code.
Thanks