0

How override a default phtml in Magento 2?

I want to update/improve the theme "magento_plushe". I add a file on app\design\frontend\magento_plushe\Magento_Theme\html\header.phtml But Magento ignore this file and load app\code\Magento\Page\view\frontend\html\header.phtml

Configuration: -Magento 2.0.0.0-dev55 -Cache disabled

2

works in 2.0.0.0-dev57 as you tried.

But: if you want to create an improved design, you should create an own theme which extends from magento_plushe.

  • I found the problem. In var/maps/fallback Magento 2 keep the default path for the header.phtml. If I clean this folder fallback, Magento regenerate new correct path for header.phtml. Clear the cache in adminhtml don't clean the maps/fallback folder... – John_iw2 Dec 25 '13 at 21:56
  • Problem is, this is not really a cache. Magento will soon introduce so called deployment scripts, which do a lot of stuff. This is one of the parts the deployment scripts will cover. – Flyingmana Dec 26 '13 at 15:25
0

The correct path to override a base template file in your case would be /app/design/frontend/PackageName/ThemeName/Magento_Theme/templates/html/header.phtml

But, be careful when overriding base template files. Only do it when you can't do it with XML/CSS. It's always better to avoid this to have an easier upgrade path when Magento 2.x is updated.

Not the answer you're looking for? Browse other questions tagged or ask your own question.