7

I'm looking to move the product review form from /review/product/list/ to the product page, underneath existing reviews, on Magento 1.9.0.1 using a child theme of RWD.

This is the original review tab in review.xml:

    <catalog_product_view>
    <reference name="product.info">
        <block type="review/product_view_list" name="product.reviews" as="reviews" template="review/product/view/list.phtml" after="additional">
            <action method="addToParentGroup"><group>detailed_info</group></action>
            <action method="setTitle" translate="value"><value>Reviews</value></action>
        </block>
    </reference>
</catalog_product_view>

This displays the reviews and form on the product page:

    <catalog_product_view>
    <reference name="product.info">
                <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" translate="label">
                        <label>Review Form Fields Before</label>
                        <action method="setMayBeInvisible"><value>1</value></action>
                    </block>
                </block>
            </block>
    </reference>
</catalog_product_view>

How do I put this into the 'reviews' tab?

2
  • Do you mean you just need to add the product review form underneath the reviews tab and despite the xml change in layout you aren't able to get it?
    – Paras Sood
    Sep 8, 2014 at 17:19
  • @ParasSood I'd like to add the review form within the 'Reviews' tab, underneath the reviews. The second bit of code above displays both the reviews and the form, but not within the 'Reviews' tab. Hope that helps...
    – rjdbgut
    Sep 8, 2014 at 17:30

5 Answers 5

9

You are going into the right direction, but you need to do some modifications:

  1. addToParentGroup and setTitle are used to show content in review so add this code below

    <action method="addToParentGroup"><group>detailed_info</group></action>
    <action method="setTitle" translate="value"><value>Reviews</value></action>
    
  2. you need to change block alias name of block type review/product_view_list to product_additional_data_review as product_additional_data alias name already exists in product.

    <block type="review/product_view_list" name="product.info.product_additional_data_review" as="product_additional_data_review" template="review/product/view/list.phtml">
        <action method="addToParentGroup"><group>detailed_info</group></action>
        <action method="setTitle" translate="value"><value>Reviews</value></action>
    
        <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" translate="label">
                <label>Review Form Fields Before</label>
                <action method="setMayBeInvisible"><value>1</value></action>
            </block>
        </block>
    </block>
    

enter image description here

2
  • can you please inform in which file , we need to update the code Jun 21, 2016 at 10:47
  • 2
    file name is review.xml
    – Amit Bera
    Jun 21, 2016 at 10:51
4

Take the catalog.xml from default to your theme and change as follows

<catalog_product_view translate="label">
    <reference name="content">
        <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
            <block type="review/product_view_list" name="product.top.reviews" as="product.top.reviews" template="review/product/view/list.phtml">
                    <block type="review/form" name="product.review.form" as="review_form" />
                </block>
        </block>
    </reference>
</catalog_product_view>

and in the detail page try adding

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

thanks a lot for the hint, for me it worked very fine. i still have a problem, the review tabs are showen twice. the xml is correctly, take a look:

  <block type="review/product_view_list" name="product.info.product_additional_data_review" as="product_additional_data_review" template="review/product/view/list.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Customer Reviews</value></action>

                <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" translate="label">
                        <label>Review Form Fields Before</label>
                        <action method="setMayBeInvisible"><value>1</value></action>
                    </block>
                </block>
            </block>
1

Add <remove name="product.reviews"/> before the tags and the duplicated version should be gone. This way the reviews block will be first removed and after this it will be added again with the new reviews block.

<block type="review/product_view_list" name="product.info.product_additional_data_review" as="product_additional_data_review" template="review/product/view/list.phtml">
    <remove name="product.reviews"/>
    <action method="addToParentGroup"><group>detailed_info</group></action>
    <action method="setTitle" translate="value"><value>Reviews</value></action>

    <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" translate="label">
               <label>Review Form Fields Before</label>
               <action method="setMayBeInvisible"><value>1</value></action>
          </block>
     </block>
</block>
1

Just put this code in your review.xml layout theme file.

<catalog_product_view>
        <reference name="product.info">
            <block type="review/product_view_list" name="product.reviews" as="reviews" template="review/product/view/list.phtml" after="additional">
                <action method="addToParentGroup">
                    <group>detailed_info</group>
                </action>
                <action method="setTitle" translate="value">
                    <value>Reviews</value>
                </action>
                <block type="review/form" name="product.review.form" as="review_form"/>
                <block type="review/product_view_list" name="product.info.product_additional_data" as="product_additional_data_review" template="review/product/view/reviews-in-tab.phtml">
                    <block type="review/form" name="product.review.form" as="review_form"/>
                </block>
            </block>
        </reference>
    </catalog_product_view>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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