0

Thanks for taking the time to look!

Basically i have not changed anything in my magento for a few months i come to add a new product yesterday and got this error.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1321-1' for key 'UNQ_mg_CATALOGINVENTORY_STOCK_ITEM_PRODUCT_ID_STOCK_ID', query was: INSERT INTO `mg_cataloginventory_stock_item` (`product_id`, `stock_id`, `qty`, `use_config_min_qty`, `is_qty_decimal`, `use_config_backorders`, `use_config_min_sale_qty`, `use_config_max_sale_qty`, `is_in_stock`, `low_stock_date`, `use_config_notify_stock_qty`, `use_config_manage_stock`, `stock_status_changed_auto`, `use_config_qty_increments`, `use_config_enable_qty_inc`, `is_decimal_divided`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, '2016-10-04 14:00:37', ?, ?, ?, ?, ?, ?)

When I make a new product when I save it I am greeted with this error, I have had a look around google and cant seam to find a problem that is the same as mine.

Any help or a point in the direction of help would be most appreciated!

1
0

Changing

$product->save();

to

$product->getResource()->save($product);
3
  • I have seen this fix around what file is this for as i have not edited anything i am unsure where to put it. – ItsLewis Oct 4 '16 at 14:44
  • are you Saving product anywhere programmaticly ? – Vishwas Bhatnagar Oct 4 '16 at 14:46
  • no not that i am aware of i am simply trying to create a new product in the backend – ItsLewis Oct 4 '16 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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