简体   繁体   中英

Cannot override block template in magento

I have read quite many posts, but for me nothing is working. Task is quite simpe - I need to override core template review/product/view/list.phtml with my own, let's say my_list.phtml

My configuration is as follows. Layout.xml (head modification is working)

<layout version="0.1.0">
<review_product_list>
    <reference name="head">
    ..
    </reference>
    <reference name="product.info">
        <block type="review/product_view_list" name="myreview.product_additional_data"
               as="myreview_product_additional_data" template="review/product/view/my_list.phtml"/>
    </reference>
</review_product_list>

Config.xml

 <frontend>
    <layout>
        <updates>
            <myreview>
                <file>myreview/layout.xml</file>
            </myreview>
        </updates>
    </layout>
</frontend>

I can change core file review.xml and it works as expected, this line

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

but this is not I am expecting.

If I change reference name="product.info" to reference name="content" My template shows up, but not in place. If I try to debug, blocks are rendered.

<review_product_list>
    <reference name="product.info.product_additional_data">
        <action method="setTemplate">
            <tpl>review/product/view/my_list.phtml</tpl>
        </action>
    </reference>
</review_product_list>

or

<review_product_list>
    <action method="setTemplate" block="product.info.product_additional_data">
        <tpl>review/product/view/my_list.phtml</tpl>
    </action>
</review_product_list>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM