1

i added below code in catalog.xml file , now reviews section is displaying in product view page. but i want to display that only under particular tab.

<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>

Is there any way we can use phtml code to display this review section.

so i am planning to use that phtml code under that tab

6
  • how to work tab is ajax or reload page for new tab.
    – Naumov
    Jul 6 '16 at 11:00
  • @Naumov please check here , under Review tab i want to display the review section Jul 6 '16 at 11:32
  • You need just call method <?php echo $this->getChildHtml(''product_review') ?> betwen <div></div> in you template tabs content. But block showld be insert in to block parent.
    – Naumov
    Jul 6 '16 at 11:37
  • i added code between div tabs as here <?php echo $this->getChildHtml('product_review') ?> but still its not displaying for me, please check view.phtml file code here : pasted.co/40ee16fb Jul 6 '16 at 11:41
  • 1
    Check your layout.xml you need pust this block <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> betwen <reference name='blockname'></reference> for example you block reviews add as <block type="core/template" name="blockname" template="at.phtml"></block> you need reference this block for get access to child block.
    – Naumov
    Jul 6 '16 at 11:47
2

Please try this code:

<?php
$reviewListBlock = $this->getLayout()->createBlock('review/product_view_list');
$reviewFormBlock = $this->getLayout()->createBlock('review/form');

echo $reviewListBlock->setTemplate('review/product/view/list.phtml')->toHtml();
echo $reviewFormBlock->setTemplate('review/form.phtml')->toHtml();
?>

Please let me know if you find any problem.

9
  • sorry for delay, it didt worked for me. Jul 6 '16 at 11:31
  • i added your code in view.phtml file under particular tab section , but it didt displayed review section there Jul 6 '16 at 11:32
  • I have checked this code in my project just before answering. Please recheck and let me know. Jul 6 '16 at 11:32
  • i added your code in several places in view.phtml file , but still not working for me. may be i am doing something wrong, can you please check view.phtml code : pasted.co/40ee16fb Jul 6 '16 at 11:40
  • Sorry, it was my mistake. I forgot to add echo in last two lines. I hvae updated my answer. Jul 6 '16 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.