Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Rating details in list
 
dmagnenat
Jr. Member
 
Total Posts:  10
Joined:  2009-05-12
 

Good morging,

I’m looking for adding the rating details directly in the list of product. All the people will be abble to see like this very fast the rate of each product. However, I don’t find in the Magento Layout which block I have to call in my list and I have’nt found any more tips on the Web.

Have you got any idea to show this rating details (template/rating/detailed.phtml) ?

I will be please you if I get an answer.

Best regards

 
Magento Community Magento Community
Magento Community
Magento Community
 
dmagnenat
Jr. Member
 
Total Posts:  10
Joined:  2009-05-12
 

It’s all right, I have resolved this question.

In fact, I have simply mixed the code of the template/rating/detailed.phtml and the Mage/Rating/Block/Entity/Detailed.php like that :

<?php
$ratingCollection = Mage::getModel('rating/rating')
->getResourceCollection()
->addEntityFilter('product') # TOFIX
->setPositionOrder()
->setStoreFilter(Mage::app()->getStore()->getId())
->addRatingPerStoreName(Mage::app()->getStore()->getId())
->load();

$ratingCollection->addEntitySummaryToItem($_product->getId(), Mage::app()->getStore()->getId());
?>
<?php if(!empty($ratingCollection) && $ratingCollection->getSize()): ?>
<table class="ratings-list" cellspacing="0">
<tbody>
<?php foreach ($ratingCollection as $_rating): ?>
<?php if($_rating->getSummary()): ?>
<tr>
<td class="label"><strong><?php echo $this->__($_rating->getRatingCode()) ?></strong></td>
<td>
<div class="rating-box">
<div class="rating" style="width:<?php echo ceil($_rating->getSummary()) ?>%;"></div>
</div>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>

And place it where I want into my view.phtml and list.phtml files.
I know, it’s not a really clean Method but it seems to work well…

Regards

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top