2

After importing a multiselect product attribute, when I try to reindex from magento admin the indexer shows error. "There was a problem with reindexing process."

Exception log :

2012-12-05T12:21:36+00:00 DEBUG (7): Exception message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '185-154-1-843' for key 'PRIMARY'
Trace: #0 /opt/lampp/htdocs/mise/lib/Varien/Db/Statement/Pdo/Mysql.php(111): Zend_Db_Statement_Pdo->_execute(Array)
#1 /opt/lampp/htdocs/mise/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /opt/lampp/htdocs/mise/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /opt/lampp/htdocs/mise/lib/Zend/Db/Adapter/Pdo/Abstract.php(239): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#4 /opt/lampp/htdocs/mise/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#5 /opt/lampp/htdocs/mise/lib/Varien/Db/Adapter/Pdo/Mysql.php(1974): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...', Array)
#6 /opt/lampp/htdocs/mise/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php(276): Varien_Db_Adapter_Pdo_Mysql->insertArray('catalog_product...', Array, Array)
#7 /opt/lampp/htdocs/mise/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php(257): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source->_saveIndexData(Array)
#8 /opt/lampp/htdocs/mise/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php(84): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source->_prepareMultiselectIndex(NULL, NULL)
#9 /opt/lampp/htdocs/mise/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(50): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source->_prepareIndex()
#10 /opt/lampp/htdocs/mise/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
#11 /opt/lampp/htdocs/mise/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
#12 /opt/lampp/htdocs/mise/app/code/core/Mage/Index/Model/Process.php(209): Mage_Index_Model_Indexer_Abstract->reindexAll()
#13 /opt/lampp/htdocs/mise/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#14 /opt/lampp/htdocs/mise/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(124): Mage_Index_Model_Process->reindexEverything()
#15 /opt/lampp/htdocs/mise/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Index_Adminhtml_ProcessController->reindexProcessAction()
#16 /opt/lampp/htdocs/mise/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('reindexProcess')
#17 /opt/lampp/htdocs/mise/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#18 /opt/lampp/htdocs/mise/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#19 /opt/lampp/htdocs/mise/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#20 /opt/lampp/htdocs/mise/index.php(87): Mage::run('', 'store')
#21 {main}

The product import file contains only 2 columns sku and attribute value

Also I tried manual import using custom php code. Same error...!!!

I think 185 in '185-154-1-843' is product id. So i went admin and just saved the product and error for that product solved but it shows duplicate entry for another product. :(

please help

4
  • Try deleting the product in admin with id 185 and importing again,as it shows : Exception message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '185-154-1-843' for key 'PRIMARY' means there are duplicated product ids.
    – huzefam
    Dec 5, 2012 at 12:38
  • deleted the product. But it shows error for another row :)
    – Zach
    Dec 6, 2012 at 5:40
  • Do you get the same error??
    – huzefam
    Dec 6, 2012 at 7:43
  • There are well explained this problem Apr 14, 2016 at 9:33

2 Answers 2

1

Worked for me:

Try deleting the product in admin with id 185 and importing again, as it shows:

Exception message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '185-154-1-843' for key 'PRIMARY'

which means that there are duplicated product ids.

Just keep deleting the error ids.

1
  • Bytheway anyone knows what is actual reason for this?
    – anshuman
    Oct 17, 2013 at 10:02
0

I had same issue. You can do something else than deleting the product :

We solved this by editing attribute which was a multiselect and inside this array of values, we had 2 times the same value!

If it occurs to someone else, just look at the attribute's value, merge siblings by removing double value and it might solve your issue.

On my case we could see that by selecting our product id ( first value inside the error duplicate entry) and having a look to the attribute mentionned ( second value in error)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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