顯示包含「import」標籤的文章。顯示所有文章
顯示包含「import」標籤的文章。顯示所有文章

2014/02/19

Cannot update qty after clearing magento db

f 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’; for product link insert into `catalog_product_link_type`(`link_type_id`,`code`) values (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell'); insert into `catalog_product_link_attribute`(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) values (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal'); insert into `cataloginventory_stock`(`stock_id`,`stock_name`) values (1,'Default');