after importing my magento project to a different localhost, i've received the following error:
There has been an error processing your request
Item (Mage_Core_Model_Store) with the same id "0" already exist
Trace:
#0 C:\xampp\htdocs\magento\lib\Varien\Data\Collection\Db.php(576): Varien_Data_Collection->addItem(Object(Mage_Core_Model_Store))
#1 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Resource\Store\Collection.php(174): Varien_Data_Collection_Db->load(false, false)
#2 C:\xampp\htdocs\magento\lib\Varien\Data\Collection.php(752): Mage_Core_Model_Resource_Store_Collection->load()
#3 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\App.php(635): Varien_Data_Collection->count()
#4 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\App.php(477): Mage_Core_Model_App->_initStores()
#5 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\App.php(360): Mage_Core_Model_App->_initCurrentStore('', 'store')
#6 C:\xampp\htdocs\magento\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#7 C:\xampp\htdocs\magento\index.php(83): Mage::run('', 'store')
#8 {main}
i am not sure how to fix it, any help is much appreciated
database:
im not sure what value i should change
core_store:
INSERT INTO `core_store` (`store_id`, `code`, `website_id`, `group_id`, `name`, `sort_order`, `is_active`) VALUES
(0, 'admin', 0, 0, 'Admin', 0, 1),
(1, 'default', 1, 1, 'English', 0, 1),
(2, 'french', 1, 1, 'French', 0, 1),
(3, 'german', 1, 1, 'German', 0, 1);
core_store_group:
INSERT INTO `core_store_group` (`group_id`, `website_id`, `name`, `root_category_id`, `default_store_id`) VALUES
(0, 0, 'Default', 0, 0),
(1, 1, 'Demand Fitness', 2, 1);
core_website:
INSERT INTO `core_website` (`website_id`, `code`, `name`, `sort_order`, `default_group_id`, `is_default`, `is_staging`, `master_login`, `master_password`, `visibility`) VALUES
(0, 'admin', 'Admin', 0, 0, 0, 0, NULL, NULL, NULL),
(1, 'base', 'Main Website', 0, 1, 1, 0, NULL, NULL, NULL);
3 Answers 3
Check core_store, core_website and core_store_group tables.
There is a possibility that in these tables Admin is created as 1 for id. It should be 0 in all cases.
If you correct them, the error will probably be gone.
-
i've update my question as i am not sure what values i should changeAN11– AN112015年09月24日 10:34:35 +00:00Commented Sep 24, 2015 at 10:34
-
1. select core_website and look for website_id attribute. 2.delete all lines in core_store and core_store_group tables has website_id attribute deference to core_website.website_id.Arunendra– Arunendra2015年09月24日 11:43:34 +00:00Commented Sep 24, 2015 at 11:43
-
i tried that but i now have this error:AN11– AN112015年09月24日 12:35:07 +00:00Commented Sep 24, 2015 at 12:35
-
Item (Mage_Eav_Model_Entity_Attribute_Option) with the same id "1" already existAN11– AN112015年09月24日 12:35:24 +00:00Commented Sep 24, 2015 at 12:35
-
i've fixed the problem, it was because some of my tables had duplicate values but thanks for your helpAN11– AN112015年09月24日 12:59:26 +00:00Commented Sep 24, 2015 at 12:59
To add a thing to @Arunendras answer:
To avoid this error make sure, that you export all data with primary keys. Then the explicit set keys 0 for customer group NOT_LOGGED_IN and admin store are set correctly.
CASE 1:
Check core_store, core_website and core_store_group tables.
SELECT * FROM core_store WHERE code='admin';
SELECT * FROM core_store_group WHERE name='Default';
SELECT * FROM core_website WHERE code='admin';
The admin value for these tables might have 1. They should be changed to 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';
CASE 2:
In another case, you might have 0 for id but there can be multiple rows inserted with the same value.
Delete such duplicate rows from core_store, core_website and core_store_group tables and the issue will be solved.
Explore related questions
See similar questions with these tags.