2

When I was trying to import some configurable products, magento admin shows the following error

General system exception happened
Additional data: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails 
(`magento2`.`catalog_product_website`, CONSTRAINT `CAT_PRD_WS_PRD_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE), query was: INSERT INTO `catalog_product_website` (`product_id`,`website_id`) VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?) ON DUPLICATE KEY UPDATE `product_id` = VALUES(`product_id`), `website_id` = VALUES(`website_id`)

But the configurable product csv successfully passed the first validation check in the admin (Check data button). But when we click the import in next step, the above error is showing.

But the product information is inserted in the "catalog_product_entity" table. When I check the product detail page in admin, the configurable product variations are not listing and that product is not listing in store view.

  • Please, add more info about your csv? – Khoa TruongDinh Aug 26 '16 at 12:32
0

I was able to solve this problem by shortening my SKUs. I had many that were over the 64 character limit imposed by the database schema and shortening them allowed for a successful import.

It is worth mentioning that the Data Checker does not currently (Oct. 2018) check for SKU length.

0

Check the list of SKU's in your CSV file. Usually this means there are invalid characters in the list.

If you go back to System > Import, and use Delete instead of Add/Update, and instruct it to STOP ON ERRORS, after you check your file it will warn you that products x - x do not exist, this indicated where the last operation fails.

Now open the CSV you are using, go to the line number magento just told you had it had a problem deleting, and you should see what caused your initial error in that line.

After that is fixed, just retry the transaction (Go back to System > Import, recheck the data, then hit the import button). Happens once in a while!

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.