Tuesday, May 31

How to Show Product Reviews on Product View Page in Magento

This is a fairly straightforward tutorial on how to bring the product reviews list and the review form out on the product page. In this example I’ll be adding it to view.phtml

1) Add form data to catalog.xml & view.phtml

The first thing to do is to add the review blocks to the correct XML reference in catalog.xml which is in app > design > frontend > default > yourtheme > layout

At about line 198 you’ll see the for the catalog_product_view class. Inside this reference add the following code:

<block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" template="review/product/view/list.phtml">
  <block type="review/form" name="product.review.form" as="review_form"/>
 </block>

Now the XML is set up, you just need to echo it on the product page in app > design > frontend > default > yourtheme > template > catalog > product > view.phtml

<?php echo $this->getChildHtml('product_review') ?>

Hope it Helps. Thanks

If you feel any difficulties while setting the magento store feel free to contact us

No comments:

Post a Comment