2

When I opened my site I had a

Fatal error: Uncaught TypeError: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance of Mage_Core_Model_Website, null given, called in /var/www/hosts/mage-composer/src/app/code/core/Mage/Core/Model/App.php on line 645 and defined in /var/www/hosts/mage-composer/src/app/code/core/Mage/Core/Model/Store.php on line 453 ( ! ) TypeError: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance of Mage_Core_Model_Website, null given, called in /var/www/hosts/mage-composer/src/app/code/core/Mage/Core/Model/App.php on line 645 in /var/www/hosts/mage-composer/src/app/code/core/Mage/Core/Model/Store.php on line 453

I opened my database and in core_store I saw enter image description here

but but the admin must have id = 0. I tried

update core_store
set `store_id` = 0
where `website_id` = 0 

but it's id(ai), and I had error

Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (`usatravel`.`label_core_store`, CONSTRAINT `FK_LABEL_CORE_STORE_WEBSITE_ID_LABEL_CORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `label_core_website` (`website_id`) ON DELETE CA)

how I can fix it? Thanks in advance

5
SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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