簡體   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