繁体   English   中英

如何使用自定义模块覆盖minicart phtml文件

[英]how to override minicart phtml file using custom module

我试图覆盖minicart phtml文件,在config.xml->中使用了此代码

<layout>
    <updates>
        <rakesh_webr module="Webr">
            <file>webr.xml</file>
        </rakesh_webr>
    </updates>
</layout>

这在我的布局配置文件(webr.xml)->中

<layout>
     <sales_order_view>
       <reference name="sales.order.view">
          <action method="setTemplate">
             <template>webr/sales/order/view.phtml</template>
          </action>
       </reference>`enter code here`
    </sales_order_view>
    <sales_order_print>
       <reference name="sales.order.print">
          <action method="setTemplate">
             <template>webr/sales/order/print.phtml</template>
          </action>
       </reference>
   </sales_order_print>
</layout>

我已经将模板放在正确的文件夹中,但是什么也没用

您可以使用以下代码。

在您的布局中添加xml文件。

将其添加到magento root\\app\\design\\frontend\\base\\default\\layout\\yourcompany.xml

<?xml version="1.0"?>   
<layout version="0.1.0">
    <default>
        <reference name="header">
            <block type="checkout/cart_minicart" name="minicart_head" template="checkout/cart/minicart.phtml" before="-">
                <block type="checkout/cart_sidebar" name="minicart_content" template="checkout/cart/minicart/items.phtml">
                    <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>yourcompany/checkout/cart/minicart/default.phtml</template></action>
                    <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer_configurable</block><template>yourcompany/checkout/cart/minicart/default.phtml</template></action>
                </block>
            </block>
        </reference>
    </default>
</layout>

然后在magento root\\app\\design\\frontend\\base\\default\\template\\yourcompany\\checkout\\cart\\minicart\\default.phtml

//Write your magic code here

暂无
暂无

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

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