I am displaying products of a particular category to the homepage content section. I have made a separate .phtml file to display my homepage. Now I want to show the ratings of a product (products are already rated). How do I show it?
If you look at the category listing template it's pretty easy to work out how category pages render out the review summary to show the rating block.
First load the product in question:
$product = Mage::getModel('catalog/product')->load($id);
Then create a product listing block to give access to the correct methods:
$block = Mage::app()->getLayout()->createBlock('catalog/product_list');
Finally run the getReviewsSummaryHtml()
method and pass it the product to get the summary HTML.
$html = $block->getReviewsSummaryHtml($product, 'short');