简体   繁体   中英

How to override .phtml file in custom module of magento?

I want to override checkout/onpepage/payment.phtml in my custom module? In my module layout.xml i had used the code give below -:

<checkout_onepage_index>
      <reference name="payment">         
            <action method="setTemplate">
                <template>giftcard/checkout/onepage/payment.phtml</template>
           </action>      
     </reference>
 </checkout_onepage_index>

But payment.phtml file is not override in my custom module.

I had gone through the below links and many more tutorials but not find the exact solution.

http://blog.chapagain.com.np/magento-overriding-template-file-from-custom-module/ http://www.magentocommerce.com/boards/viewthread/262202/#t352074 Magento Extension Needs to Override a Template

I had cleared the browser cache and magento cache.

Customizing the core Magento 2 functionality is a bad coding practice. The solution is to override a phtml file using a custom module in Magento 2.

Methods to Override a phtml file using a custom module in Magento 2:

  1. with plugin
  2. with XML

Learn the implementation of both the methods at https://meetanshi.com/blog/override-phtml-file-using-custom-module-in-magento-2/

Please also override it's .phtml file with the help of "block" tag in app/code/design/THEME/layout/checkout.xml. I have do this thing for one time. it works for me. i hope it will also work for u......

使用checkout.onepage.payment作为参考而不是付款,这将帮助您

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