简体   繁体   English

无法覆盖magento中的块模板

[英]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 任务很简单-我需要用我自己的核心模板review / product / view / list.phtml覆盖,例如my_list.phtml

My configuration is as follows. 我的配置如下。 Layout.xml (head modification is working) Layout.xml(正在修改头部)

<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 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 我可以更改核心文件review.xml,它可以按预期工作,此行

<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. 如果将引用名称=“ product.info”更改为引用名称=“ content”,则会显示我的模板,但位置不正确。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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