Categories


Archives


Recent Posts


Categories


Fatal error: Call to a member function getId() on a non-object in lib/internal/Magento/Framework/View/Model/Layout/Merge.php on line 745

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

I ran into this error

Fatal error: Call to a member function getId() on a non-object in /path/to/magento/lib/internal/Magento/Framework/View/Model/Layout/Merge.php on line 745

after loading a new system’s MySQL database into my local development environment. Magento 2’s theme settings allow you to pick a specific theme from a drop down menu. From a UI perspective, this is an improvement over Magento 1. However, it does mean that Magento now stores a theme’s ID in the core_config_data table instead of a the raw string name. This, in turn, means Magento needs to load a theme object (from the theme table). If Magento can’t find the theme path, it won’t load the object, which leads to this error.

To fix this — your backend should still be working. Just navigate to

Stores -> Configuration -> Design

and pick a new design theme. You can also try setting the value directly in core_config_data under the path design/theme/theme_id.

Copyright © Alan Storm 1975 – 2019 All Rights Reserved

Originally Posted: 1st December 2015