5

Is it possible to override Magento 2 Luma phtml Files? I've created a new theme based on Luma which is working perfectly but I can't find any phtml files anywhere.

I've also noticed my app/code directory is completely empty.

Liam McArthur
  • 1,319
  • 4
  • 20
  • 40
  • You may be download code from magento site instead of github thus you can not see app/code.You see all module at vendor/magento folder ... It composer already implement this code base. If want to custom theme then create app/code and implement whatever yiu want – Amit Bera Feb 12 '16 at 08:25

2 Answers2

7

you can find luma theme files are located

copy from here

vendor/magento/theme-frontend-luma

add in your theme

app/design/frontend/spacename/theme/

you are missing templates in path /app/design/frontend/Penguin/default/Magento_Theme/templates/html/header.phtml

Qaisar Satti
  • 32,469
  • 18
  • 85
  • 137
  • Didn't work for me. I still can't get the header.phtml file to work, without editing the "vendor" version. – Liam McArthur Feb 15 '16 at 20:26
  • did you set your theme in admin? – Qaisar Satti Feb 16 '16 at 04:33
  • Sure did! And cleared the cache in both the back end and the browser. – Liam McArthur Feb 16 '16 at 07:26
  • did you deploy the content. php bin/magento setup:static-content:deploy en_US – Qaisar Satti Feb 16 '16 at 07:29
  • Yeah I did. The theme is showing as active in the back end but when displaying the active blocks using the developer hinting options it's still getting all phtml files from vendor. The css and images are the only items that are correctly being pulled from my custom theme (copy of Luma renamed). – Liam McArthur Feb 16 '16 at 07:34
  • can you add one phtml file path? here so i can check there is not problem in path. – Qaisar Satti Feb 16 '16 at 07:41
  • The file path is /app/design/frontend/Penguin/default/Magento_Theme/html/header.phtml - I also created a module which is active but doesn't pull in the file app/code/Atomic/Penguin/view/frontend/templates/html/header.phtml. I just want to easily be able edit some of the vendor phtml files, without editing vendor itself (I'm assuming I'm not supposed to edit vendor files). – Liam McArthur Feb 16 '16 at 07:49
  • 1
    you are missing templates in path /app/design/frontend/Penguin/default/Magento_Theme/templates/html/header.phtml this will be your file path – Qaisar Satti Feb 16 '16 at 07:51
3

App/code empty is ok if you installed via Composer!

In your app/design/frontend/Magento/luma folder you can find all your modules that are customized either from app/design/frontend/Magento/luma or the core modules app/code/Magento/

For catalog list phtml you can for example copy the files from app/code/Magento/catalog/view/frontend/templates/product/list.phtml into your custom app/design/frontend/<yourvendorfolder>/<yourthemefolder>/Magento_Catalog/templates/html/list.phtml

here you go, think you should run through the devdocs some more to get to know the logic behind the magento2 file and override structure. its not like Magento1 just copy over few templates files and done. 85% is done via layout xml files and just small bits via phtml.

Good luck!

Kay Int Veen
  • 1,503
  • 2
  • 15
  • 26
  • app/code being empty is perfectly fine if you have installed magento using composer. Everything will live in the vendor/ directory instead. – Smartie Feb 12 '16 at 08:32
  • pls check following path vendor/magento/theme-frontend-luma – Pratik Feb 12 '16 at 08:36
  • I can't find any .phtml files inside vendor/magento/theme-frontend-luma either! – Liam McArthur Feb 13 '16 at 09:14
  • 1
    i just copy template from vendor\magento\theme-frontend-luma to design in app but after clear cache theme not apply new template – mrtuvn Feb 15 '16 at 10:53