Magento how to get rating star by review id
I used the following code
$ratingCollection = Mage::getModel('rating/rating_option_vote')
->getResourceCollection()
->setReviewFilter($_review->getId())
->setStoreFilter(Mage::app()->getStore()->getId())
->addRatingInfo(Mage::app()->getStore()->getId())
->load()
->getItems();
$ratings = array();
foreach($ratingCollection as $item){
$ratings[]=$item->getValue();
}
but I am getting array summary as 12, 15 but I need %
Thanks
Best Answer
The
rating_option_vote
table saves to vote option for a particular rating type.This table has
review_id
as the foreign key which references to review table.Please check screenshots for reference.
Update: Code for getting ratings per review:
Update: You can also try below code: