Magento Error
Category: Magento 1 Tags: , Comments: 0

The error message

Recoverable Error: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance of Mage_Core_Model_Website, null given

in Magento happens extremely rarely and only under certain circumstances. However, the cause is very difficult to find and understand.

It happened once with a customer, but nobody knows how it could have happened. The cause is that the admin store IDs have changed, which does not normally happen.

To rectify the error, simply reset them using an SQL command:

[sql] 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; [/sql]

Then clear the cache as usual if necessary.

Leave a Reply

Your email address will not be published. Required fields are marked *