SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`catalog_product_entity`, CONSTRAINT `FK_CAT_PRD_ENTT_ATTR_SET_ID_EAV_ATTR_SET_ATTR_SET_ID` FOREIGN KEY (`attribute_set_id`) REFERENCES `eav_attribute_set` (`attribute_set_i)

junio 15th, 2012 Posted by magento 0 thoughts on “SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`catalog_product_entity`, CONSTRAINT `FK_CAT_PRD_ENTT_ATTR_SET_ID_EAV_ATTR_SET_ATTR_SET_ID` FOREIGN KEY (`attribute_set_id`) REFERENCES `eav_attribute_set` (`attribute_set_i)”

Luego de hacer un upgrade de Magento 1.4.2 a Magento 1.6.2 el script de importación de productos dejó de funcionar.

Estuve horas buscando este error


SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or
update a child row: a foreign key constraint fails
(`magento_sdny_new`.`catalog_product_entity`, CONSTRAINT
`FK_CAT_PRD_ENTT_ATTR_SET_ID_EAV_ATTR_SET_ATTR_SET_ID` FOREIGN KEY
(`attribute_set_id`) REFERENCES `eav_attribute_set` (`attribute_set_i)


 
Finalmente descubrí aquí que este error se debe a esta línea específicamente:

$pr_simple->setAttributeSetId(9);

Y se puede deber a dos razones:

  • O bien no se está proveyendo ningún valor en el setAttributeSetId($id).
  • O bien el valor que se está proveyendo no existe en la instalación de Magento.

Otra cosa que tuve que hacer es ir a Sistema > Index Management y setear el índice “Product Prices” como manual.

Copyright © 2018 programadorfreelanceargentina.com

Programador Freelance Argentina