I am trying to update several products that are fed from an XML file using:
$productid = Mage::getModel('catalog/product')->getIdBySku($url->product);
echo 'Loaded Product: ' . $url->product;
// Initiate product model
$product = Mage::getModel('catalog/product');
$product->setPrice($url->price);
try
{
$product->save();
echo "Save / Updated"."\r\n";
}
catch (Exception $ex) {
echo "<pre>".$ex."</pre>";
}
The problem I’m getting a SQL error:
exception 'Mage_Eav_Model_Entity_Attribute_Exception' with message 'SQLSTATE[23000]:
Integrity constraint violation: 1062 Duplicate entry '531-0-82-1.0000-0'
The product with the ID of 531 does exist in my db, all I’m wanting to do is update it’s price.
What could be causing this?
Well it seemed to not like the fact I had tiered prices on that product.
Cleared them, re-indexed, re-created tiered pricing, all seems good