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”
<!-- 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>
And then go to “\template\review\product\view\list.phtml” and add following code in it :
<?php
$reviewUrl = str_replace("/catalog/", "/review/", $this->getReviewUrl());
?>
and replace :
<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())) ?>
with :
<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())) ?>
Hope this will help you
Regards,
Amatya Trivedi
amatya@intelligrape.com
This entry was posted
on March 8th, 2013
at
2:52 pm and is filed under
CMS .
You can follow any responses to this entry through the
RSS 2.0 feed.
You can leave a response, or trackback from your own site.
