Thursday, November 24, 2011

Magento SQLSTATE[23000] error

Magento error:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`LittleDickyBird`.`catalog_category_product_index`, CONSTRAINT `FK_CATALOG_CATEGORY_PROD_IDX_CATEGORY_ENTITY` FOREIGN KEY (`category_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON 
Solution: 
Replace the line: $newproduct->setWebsiteIDs(array(0)); should be:$newproduct->setWebsiteIDs(array(1)); 
Enjoy 

No comments:

Post a Comment