Programming language e.g. PHP, JAVASCRIPT, coding, web developing hints and skills applying on mobile device e.g. iphone
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');
2013/10/07
SQLSTATE[23000] Duplicate entry 'xxx' for key 'PRIMARY'
Problem:
When saving related product, it shows an error :
magento SQLSTATE[23000] Duplicate entry '959' for key 'PRIMARY'
Reason:
yes it right, the key is really duplicate in the table
after checking the related product table --- catalog_entity_product_link, the auto increment of 'link_id' is 950 but the latest record is '959', and it doesnt make sense
Solution:
(1) increase the auto increment to 959 , SET AUTO_INCREMENT = 959
or
(2) delete the record after 950, and then save these related product again
訂閱:
文章 (Atom)