Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

Integrity constraint violation: 1062 for key ‘PRIMARY
Jr. Member
Total Posts:  6
Joined:  2009-10-26


I am trying to update product quantity via cron below is the function :

public function manageStockByCron() {
$i 0;
$_productsCollection as $_product)
$this->_productInstance $productObj;
$supplierQuantity $this->getSupplierStockQuantity();
is_array($supplierQuantity) && $supplierQuantity[\\\\\\\'have_error\\\\\\\'!= true) || $productObj->getTypeId() == \\\\\\\'simple\\\\\\\'{
// get product\\\\\\\'s stock data such quantity, in_stock etc
$stockData $productObj->getStockData();
// update stock data using new data
if(isset($supplierQuantity[\\\\\\\'qty\\\\\\\']) && $supplierQuantity[\\\\\\\'qty\\\\\\\'0):            

// then set product\\\\\\\'s stock data to update

// call save() method to save your product with updated data
for ($j 1$j <= 9$j++) {

But i am getting this error

exception \\\\\\\’PDOException\\\\\\\’ with message \\\\\\\’SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry \\\\\\\’44-70-1-109\\\\\\\’ for key \\\\\\\’PRIMARY\\\\\\\’\\\\\\\’ in lib/Zend/Db/Statement/Pdo.php:228

I tried a lot to resolve the issue but not getting suceess ...

Pls .... Pls Help !!

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top