Displaying Review Block (with ratings) On Product Page In Magento
One of the most common customization in magento is to display reviews and ratings on the product page itself. This blog will show you how to render reviews and ratings on product page. Following are steps.
Open your theme’s catalog.xml and include the following code inside block type=”catalog/product_view”
[php]
<!– For adding review page on product page –>
<block type="catalog/product_view" name="product.info.addto" as="addto" template="catalog/product/view/addto.phtml"/>
<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart.phtml"/>
<block type="catalog/product_view" name="product.tierprices" as="tierprices" template="catalog/product/view/tierprices.phtml"/>
<block type="core/template" name="product.info.other" as="other" template="review/product/view/other.phtml"/>
<block type="page/html_pager" name="product_review_list.toolbar" />
<block type="core/template" name="product_review_list.count" template="review/product/view/count.phtml" />
<block type="review/product_view_list" name="product.info.product_additional_data" as="product_additional_data" template="review/product/view/list.phtml">
<block type="review/form" name="product.review.form" as="review_form">
<block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before">
<action method="setMayBeInvisible"><value>1</value></action>
</block>
</block>
</block>
[/php]
And then go to “\template\review\product\view\list.phtml” and add following code in it :
[php]
<?php
$reviewUrl = str_replace("/catalog/", "/review/", $this->getReviewUrl());
?>
[/php]
and replace :
[php]
<a href="<?php echo $this->getReviewUrl($_review->getId()) ?>"><?php echo $this->htmlEscape($_review->getTitle()) ?></a> <?php echo $this->__(‘Review by <span>%s</span>’, $this->htmlEscape($_review->getNickname())) ?>
[/php]
with :
[php]
<a href="<?php echo $reviewUrl.’id/’.$_review->getId().’/’ ?>"><?php echo $this->htmlEscape($_review->getTitle()) ?></a> <?php echo $this->__(‘Review by <span>%s</span>’, $this->htmlEscape($_review->getNickname())) ?>
[/php]
Hope this will help you 🙂
Regards,
Amatya Trivedi
amatya@intelligrape.com
sorry to say but i did all the steps as you given above but actually i have troubling with the same problem that there is no review form on my product page
Hello Amatya,
We have successfully implementing review or rating on Magento site’s products pages, but we are facing on Google. How can we see review & rating on Google(SERP), please suggest us…. My website is as : fashos.com