3

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);
1

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 change – AN11 Sep 24 '15 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 Sep 24 '15 at 11:43
  • i tried that but i now have this error: – AN11 Sep 24 '15 at 12:35
  • Item (Mage_Eav_Model_Entity_Attribute_Option) with the same id "1" already exist – AN11 Sep 24 '15 at 12:35
  • i've fixed the problem, it was because some of my tables had duplicate values but thanks for your help – AN11 Sep 24 '15 at 12:59
1

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.

0

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.

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.