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 magento.stackexchange.com, 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 community@magento.com.

Magento Forum

Catalog Inventory - SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`catalogin
 
kamaljoshi
Member
 
Avatar
Total Posts:  46
Joined:  2011-01-11
Ahmedabad
 

If you failed to create a new product from admin and you’ll get an error message something like this

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`cataloginventory_stock_item`, CONSTRAINT `FK_CATALOGINVENTORY_STOCK_ITEM_STOCK` FOREIGN KEY (`stock_id`) REFERENCES `cataloginventory_stock` (`stock_id`) ON DELETE CASCADE ON UPDATE)

You have to check whether you deleted entry from cataloginventory_stock table. If yes then please use below query to add new product.

INSERT INTO cataloginventory_stock SET stock_name = ‘Default’;

I faced this issue, might be helpful to others.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bkjain
Jr. Member
 
Total Posts:  14
Joined:  2012-10-10
 

It’s Really helpful..
It’s save my time..
Thanx lots....

 
Magento Community Magento Community
Magento Community
Magento Community
 
solSEM
Jr. Member
 
Total Posts:  4
Joined:  2010-09-27
 

Thank you for sharing this. I had the same problem after removing all catalogs, products etc.  from the default magento installation.
I followed your instruction by going to MYSQL and cataloginventory_stock table and INSERT a new row with ID=1 and NAME=Default.
it worked!

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