简体   繁体   中英

how to override minicart phtml file using custom module

I am trying to override minicart phtml file, used this code in config.xml->

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

and this in my layout config file (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>

and i have put the templates in right folder but nothing is working

You can use the following code.

In your layout add the xml file.

Add this inside the 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>

Then create the file in magento root\\app\\design\\frontend\\base\\default\\template\\yourcompany\\checkout\\cart\\minicart\\default.phtml

//Write your magic code here

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