Monday, February 6, 2012

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-0-1' for key 'PRIMARY', SQL error when updating products in Magento

Hi

When you edit products from back end

i\’e when updating products in admin you will get one sql error Integrity constraint violation: 1062 Duplicate or SQLSTATE[23000]

this error will happen if you install the module called simple organic for config products

so there is quick fix for this issue

Class: OrganicInternet_SimpleConfigurableProducts_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price
Method: public function catalogProductSave(Mage_Index_Model_Event $event)

file path is

app\code\community\OrganicInternet\SimpleConfigurableProducts\Catalog\Model\Resource\Eav\Mysql4\Product\Indexer\Price.php

Change:
$this->cloneIndexTable(true);
on line 58 to:
$this->clearTemporaryIndexTable();

Enjoy

1 comment: