This has been covered in many places, but worth sharing it from here :

Method 1
Go to your theme’s
app/design/frontend/base/default/template/catalog/product/view.phtml

find the following code, and comment as blow

 <?php //echo $this->getReviewsSummaryHtml($_product, false, true)?>

And replace with the following:

 <?php echo $this->getReviewsSummaryHtml($_product, 'short')?>

In the view.phtml file, “$this” points to class Mage_Catalog_Product_View in /var/www/http/app/code/core/Mage/Catalog/Block/Product/View.php

And the $_product is the product object which has been loaded for us so the code

$this->getReviewsSummaryHtml($_product, false, true)

works. But, if you want to show the above code in other pages, where product object is not loaded, please ensure you load the product  first -- like as follows

<?php

$productId = "1234";

$product = Mage::getModel('catalog/product')->load($productId);

echo $this->getReviewsSummaryHtml($product, 'short')

?>

Keep an eye that I used $product not $_product, it’s upto you!

Method 2

This method actually shows the stars based on number of reviews and corresponding ratings

<?php
//reviews are based on store, so get store Id
$storeId = Mage::app()->getStore()->getId();
//now load the review of the product based on set store id
$ratingSummaryData = Mage::getModel('review/review_summary')
       ->setStoreId($storeId)
       ->load($_product->getId());
?>

<div class="ratings">
<p class="rating-title"><?php echo "Ratings :" ?></p>
<div class="rating-box">
<div class="rating" 
style="width:<?php echo $ratingSummaryData['rating_summary']; ?>%">
</div>
</div>
<p class="rating-title">

<?php

 //this shows like - 4.0 / 5.0 5 Review(s)

echo ( (5 / 100) * $ratingSummaryData->getRatingSummary()) . 
' / 5.0 ' . $ratingSummaryData['reviews_count'] . ' Review(s)'

?> </p> </div>

The output is

ratings_number_of_reviews

 

Hope it helps some one.

Cheers!

[wysija_form id=”2″]

Categorized in: