Question

Im getting errors after I done a fresh install to magento 2.1.6 and relinked to old DB. Now when I select certain items in the menu it will throw this error. I went to DB and changed the theme ID over but then it goes from Key 6 to Key 4.

What can i do to fix this problem

Any help is greatly appreciated.

a:4:{i:0;s:42:"Unable to load theme by specified key: '6'";i:1;s:9519:"

#0 /home/www/public_html/vendor/magento/module-theme/Model/View/Design.php(148): 
Magento\Framework\View\Design\Theme\FlyweightFactory->create('6', 'frontend')

enter image description here

enter image description here

Was it helpful?

Solution

See if you have saved the theme in products or categories. In product attribute group 'Schedule Design Update', attribute New Theme, attribute code custom_design. Also check categories attribute 'Custom Design', attribute code custom_design.

You need to update the products and categories data for this attribute in database.

`SELECT * FROM eav_attribute WHERE attribute_code = "custom_design";`

There are 2 entries, 1 from product and 1 from category.

`SELECT * from catalog_product_entity_varchar WHERE attribute_id = product custom design attribute id ;`

`SELECT * from catalog_category_entity_varchar WHERE attribute_id = category custom design attribute id ;`

Most likely you didn't set on purpose the Schedule Design on products. You can delete the entries in catalog_product_entity_varchar on attribute id custom_layout.

The same to catalog_category_entity_varchar. Or update with empty string/null in these 2 tables. Or set the new theme id, if you set those values on purpose.

Usually the theme id is in products or categories because product imports or other mass action.

Last, reindex all and flush cache.

Also, widgets can have the theme id set. SELECT theme_id FROM widget_instance; Cms pages: SELECT custom_theme FROM cms_page;

Check 'design_*' tables too.

An extra thing to do would be to dump the structure of the database and search on word 'theme'.

OTHER TIPS

First, check the theme ID in the core config table. As mentioned in the screenshot.

Run basic commands like.

rm -r pub/static/* var/view_preprocessed/* var/cache/* var/di var/generation
bin/magento cache:clean
bin/magento cache:flush
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy

If still error is persisting, Then Update category and product theme section because category and products are attached to the theme that is already moved.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top