14

I created a new theme and it was working fine but after a few days, I realized some things weren't working.

default_head_blocks.xml is no longer pulling in any css files that I include (both hosted and external)

default.xml is not overwriting parent one.

I'm not sure what is causing this. I even tried deleting /var/ folder as well as /pub/static/frontend/

1
  • Have you tried deploying content? php bin/magento setup:static-content:deploy
    – Shahzad K
    Commented Sep 2, 2016 at 20:19

3 Answers 3

71

Check your DB. There is a table called theme that stores a reference to all the themes that have ever been installed in your store. If the type of the theme is set to 1, that means Magento sees the theme are virtual (what ever that means) and will no longer load your xml files. If that is the case, just change it to 0. I don't know the why of this issue, but it has tripped me up a few time.

enter image description here

16
  • 1
    This fixed it for me! I had to set this type value to '0' in the Database. After that I recompiled en deployed all static content. Finally my layout XML's where loaded again! Still no idea how this database type got set to 1 :S Thank you @circlesix Commented Nov 2, 2016 at 11:43
  • 2
    Oh My god... I have been stumbling around in the dark for no lie the past 16 hours... Freaking Magento! Thank you so much. Commented Nov 10, 2017 at 2:13
  • 1
    You are a legend! I'd been searching for it for hrs and for one point thought that it's something to do 2.1 to 2.2 upgrade. Thank you for the help! Commented Oct 10, 2018 at 12:47
  • 1
    Thanks! for quick patch, reporting it to magento2. Commented Oct 31, 2018 at 13:05
  • 2
    Ran into this in 2.3.4. Finally figured out that layout xml wasn't being loaded and that led me here. There is a function, Magento\Theme\Model\Theme\Registration::checkPhysicalThemes, which loops through all registered themes and sets them to virtual if the folder is not found in the filesystem. Not exactly sure how it is triggered, but it seems that if you are messing around with themes and make a change in the admin while a theme folder is not in its expected location (or maybe permissions are off?), it will be automatically set to virtual. Unhelpful, Magento.
    – jiheison
    Commented Jun 8, 2020 at 2:25
1

For me, the issue is not fixed after set type=0. Then I figured out we are running Magento with default mode. Issue fixed after switched to production mode.

1

I agree with Bilal, changing with type=0 in the theme table, did not work for me also.

What Worked for me in my Magento2.3.4

  1. Reverted back to type=1 in theme table.

  2. Change Mode to Developer Mode - Run

    php bin/magento deploy:mode:set developer && php bin/magento cache:clean

  3. In Developer Mode - You will see XML errors.

  4. Check the System.log, It may also contains errors, Fix the errors - See Screenshot

  5. Run

    php bin/magento deploy:mode:set production

    php bin/magento deploy:mode:set default

    php bin/magento setup:static-content:deploy

    php bin/magento cache:clean

Now your layout should start working

enter image description here

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