0

So after spending 3 hours on this I am out of ideas. How can I set the template for the block commented below (:32) from my custom layout file. This is the original layout (I'm running Magento 1.9):

<layout>
    <review_product_list translate="label">
        <label>Catalog Product Reviews List</label>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        </reference>
        <reference name="head">
            <action method="addJs"><script>varien/product.js</script></action>
            <action method="addJs"><script>varien/configurable.js</script></action>
        </reference>
        <reference name="content">
            <block type="review/product_view" name="product.info" template="catalog/product/view.phtml">
                <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml">
                    <action method="disableGallery"/>
                </block>
                <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">
                    <!-- workaround: a better place for this code is in paypal.xml -->
                    <block type="page/html_wrapper" name="review.product.info.addtocart.paypal.wrapper" translate="label" module="paypal">
                        <label>PayPal Express Checkout Shortcut Wrapper</label>
                        <block type="paypal/express_shortcut" name="review.product.info.addtocart.paypal" template="paypal/express/shortcut.phtml">
                            <action method="setIsInCatalogProduct"><value>1</value></action>
                        </block>
                    </block>
                </block>
                <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">
                    <!-- THIS BLOCK HERE --><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>
            </block>
        </reference>
    </review_product_list>

And this is what I have reached so far but doesnt seem to work:

<layout version="0.1.0">

     <review_product_list translate="label">


      <reference name="review_form">
            <action method="setTemplate">
                  <template>appfactory/review/form.phtml</template>
            </action>
      </reference>

Update 1

Okay so I made some progress and discovered that the problem is not initially in picking up the layout updates, I can't actually change the template of the block. So If i changed it to the following:

<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"  template="appfactory/review/form.phtml">
        <action method="setTemplate">
           <template>appfactory/review/form.phtml</template>
        </action>
        <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>

the block template is still not updated to appfactory/review/form.phtml and still picks up the old template review/form.phtml

0

Change your code with below code:

     <reference name="review_form">
            <action method="setTemplate">
                  <template>appfactory/review/form.phtml</template>
            </action>
      </reference>

Replace with:

<layout version="0.1.0">
    <review_product_list translate="label">
        <reference name="product.review.form">
            <action method="setTemplate">
                <template>appfactory/review/form.phtml</template>
            </action>
        </reference>
    </review_product_list>
</layout>
  • This is actually Magento 1.9, don't think I have referenceBlock yet – Yehia A.Salam Nov 28 '16 at 6:21
  • Updated answer please check it – Prashant Valanda Nov 28 '16 at 6:40
  • I actually updated the question, the template is not getting picked up even if I set both setTemplate and the template attribute – Yehia A.Salam Nov 28 '16 at 21:37
  • add my given code in local.xml of your theme it is working fine for me – Prashant Valanda Nov 29 '16 at 5:11

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.