Whenever I delete a website, magento returns the error: Invalid website id requested. I've to delete from db tables core_store
and core_store_group
the website id and then I can log again in the admin.
Is a Magento bug or I have some problem in my magento instance?
PS: I usually create websites programmatically by the script:
$rootCategory = Mage::getModel('catalog/category');
$rootCategory->setStoreId(0)
->setName('Demo')
->setPath(1)
->setDisplayMode('PRODUCTS')
->setIsActive(1)
->save();
$website = Mage::getModel('core/website');
$website->setCode('demo')
->setName('demo')
->save();
//#addStoreGroup
/** @var $storeGroup Mage_Core_Model_Store_Group */
$storeGroup = Mage::getModel('core/store_group');
$storeGroup->setWebsiteId($website->getId())
->setName('demo')
->setRootCategoryId($rootCategory->getId())
->save();
//#addStore
/** @var $store Mage_Core_Model_Store */
$store = Mage::getModel('core/store');
$store->setCode('demo_en')
->setWebsiteId($storeGroup->getWebsiteId())
->setGroupId($storeGroup->getId())
->setName('demo_en')
->setIsActive(1)
->save();
core_store
andcore_store_group
tables have the foreign key set onwebsite_id
?