nikhil joshi
nikhil joshi

Reputation: 11

Magento Unique Key error with Inventory and SAP

I'm trying to configure Magento using SAP as a back end.

I have connected to the SAP system using PHP script. And also I have added data to it. Now I'm trying to update the added data, but I'm stuck on an error.

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '298-1' for key 'UNQ_CATALOGINVENTORY_STOCK_ITEM_PRODUCT_ID_STOCK_ID'' in D:\xampp\htdocs\magento\lib\Zend\Db\Statement\Pdo.php:228

Stack trace:

#0 D:\xampp\htdocs\magento\lib\Zend\Db\Statement\Pdo.php(228): PDOStatement->execute(Array)

#1 D:\xampp\htdocs\magento\lib\Varien\Db\Statement\Pdo\Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)

#2 D:\xampp\htdocs\magento\lib\Zend\Db\Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)

#3 D:\xampp\htdocs\magento\lib\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)

#4 D:\xampp\htdocs\magento\lib\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)

#5 D:\xampp\htdocs\magento\lib\Varien\Db\Adapter\Pdo\Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)

#6 D:\xampp\htdocs\magento\lib\Zend\Db\Adapter\Abstract.php(574): Varien_Db_Adapter_Pdo_ in D:\xampp\htdocs\magento\lib\Zend\Db\Statement\Pdo.php on line 234

Kindly help me solve this issue.

Upvotes: 1

Views: 2390

Answers (2)

feeela
feeela

Reputation: 29932

If one has installed the extension "Market Ready Germany", you need to make sure your browser is sending a referrer – otherwise the above error will occur. (With no hint on the referrer…)

Upvotes: 0

Jonathan Day
Jonathan Day

Reputation: 18702

Try performing a full reindex from System>Index Management in the admin. If that fails, truncate the cataloginventory_stock_status_idx table and reindex, then run your script again.

Upvotes: 0

Related Questions