I'm trying to add simple products to a bundle in Magento, but I'm getting an SQL error whenever I try. The specific error I'm getting is
SQLSTATE: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails ('magento'.'catalog_product_relation', CONSTRAINT 'FK_CAT_PRD_RELATION_CHILD_ID_CAT_PRD_ENTT_ENTT_ID' FOREIGN KEY ('child_id') REFERENCES 'catalog_product_entity' ('entity_id') ON DELETE CASCAD), query was: INSERT INTO 'catalog_product_relation' ('parent_id','child_id') VALUES (?, ?)
So essentially, when trying to add a new row to
catalog_product_relation, for each product I try to add, rather than the bundle and simple product ID's it's using
This is quite a large bundle with over 250 simple products spread across 10 categories, I've checked the
catalog_product_relation table and there's no unexpected rows, and I've made sure all products are available in this store/website and are enabled, is anyone able to shed any light on why it's passing through these blank values?
EDIT: It seems that after having successfully added two or three simple products without getting the SQL error, 20 products which were previously saved without issue have disappeared from the bundle, their empty categories are still there however