0

I want to show rating star on recently viewed products. Is that possible?

 <?php foreach ($_products as $_item):  ?>
 <?php if($_item->getRatingSummary()){ ?>
                      <?php echo $this->getReviewsSummaryHtml($_item, 'short') ?>

                     <?php }?>
 <?php endforeach; ?>
0

Yes, you can get the rating summary by below code

<?php
$storeId = Mage::app()->getStore()->getId();
$summaryData = Mage::getModel('review/review_summary')
                    ->setStoreId($storeId)
                    ->load($item->getId()); //your product id
if($summaryData->getRatingSummary()):
?>
    <div class="ratings">
        <div class="rating-box">
            <div class="rating" style="width:<?php echo $summaryData->getRatingSummary(); ?>%"></div>
        </div>
    </div>
<?php endif;?>
0

You can do this by modifying your THEME/default/reports/product_viewed.phtml template file, render the rating html with:

<?php
    $storeId = Mage::app()->getStore()->getId();
    $summaryData = Mage::getModel('review/review_summary')->setStoreId($storeId)->load($_item->getId());
?>

<?php if ($summaryData['rating_summary']):?>
    <div class="ratings">
    <div class="rating-box">
      <div class="rating" style="width:<?php echo $summaryData['rating_summary']; ?>%"></div>
      </div>
    </div>  
<?php endif; ?> 

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.