I'm having kinda serious issue with CSV product import. When I'm trying to import only one product from CSV (for testing reasons) I get following error:
SQLSTATE: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (admin_knygynas.catalog_product_entity_media_gallery, CONSTRAINT FK_CAT_PRD_ENTT_MDA_GLR_ATTR_ID_EAV_ATTR_ATTR_ID FOREIGN KEY (attribute_id) REFERENCES eav_attribute (attribute_id) ), query was: INSERT INTO catalog_product_entity_media_gallery (attribute_id,entity_id,value) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE entity_id = VALUES(entity_id)
Got this issue first time, searched where I can, but no solutions so far, sitting on this one for hours. I see that it tries to insert VALUES(?,?,?) into product media gallery entity, and it doesn't make any sense.
I exported CSV from Magento 1.7.2 version, and trying to import to 1.9.2. But i was reading somewhere that it doesn't make any difference. I did all the steps. Created missing attributes, imported categories with another module so everything there should be fine.
Solved! Go to Solution.
Found the solution! In the CSV file i have noticed that there is an attribute called _media_attribute_id, exported a product from my default site, and seen that it was 720 and in my other csv file it was 90.. So i have changed the id from 90 to 720 and it fixed my problem!