0

When saving a product that is already existing in the description the product is giving a weird error on the database:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or 


update a child row: a foreign key constraint fails (`magento`.`catalog_product_entity`, CONSTRAINT 


CAT_PRD_ENTT_ATTR_SET_ID_EAV_ATTR_SET_ATTR_SET_ID` FOREIGN KEY 


(`attribute_set_id`) REFERENCES `eav_attribute_set` 


(`attribute_set_id`) ON DELET), query was: UPDATE 


`catalog_product_entity` SET `attribute_set_id` = ?, `type_id` = ?, 


`sku` = ?, `has_options` = ?, `required_options` = ?, `created_at` = 


'2017-11-01 20:36:00', `updated_at` = '2017-11-03 16:48:30' WHERE 


(`entity_id`=162)

What is going wrong and where can I resolve this? It is not happening for all products but just for certain products in the collection.

0

I also had the same error, in my case this error occur when I was trying to assign attribute set to a product which is not exist. So please check if Attribute set exist or not which you are trying to assign to your product.

Or check your max_input_vars value and update it to 3000 or 5000, if it is less.

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.