3

我已使用此链接 中的 SQL 脚本删除所有测试产品数据和类别。然后我阅读了“产品”类别,然后导入了我的 CSV 文件,Magento 在检查数据时说这很好,但是当我单击导入时,我收到以下错误:

SQLSTATE [23000]:完整性约束违规:1452 无法添加或更新子行:外键约束失败(gare6221_qshed/catalog_product_website,CONSTRAINT FK_CAT_PRD_WS_PRD_ID_CAT_PRD_ENTT_ENTT_IDFOREIGN KEY ( product_id) REFERENCES catalog_product_entity( entity_id) ON DELETE CASCADE)

有什么想法吗?我真的在努力解决这个问题。

谢谢

4

3 回答 3

4

这已得到修复,问题是由于 SKU 长度超过 64 个字符。

于 2012-07-11T09:40:48.133 回答
0

我要说的第一件事是避免直接对数据库进行操作。它会很快变得一团糟(正如你正在学习的那样)。

话虽如此,看起来您可能在某处有一些剩余数据。也许是catalog_product_website?

于 2012-04-20T14:57:17.743 回答
0

也遇到了这个问题,虽然 SKU 似乎不是原因(我们的 SKUS 的格式是 'FOO-####'),所以它们都没有接近 64 个字符。

当我选择 csv 文件并选择检查数据时,它通过了检查:

Checked rows: 1718, checked entities: 47, invalid rows: 0, total errors: 0
File is valid! To start import process press "Import" button

但是,在选择导入后,我收到此错误:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magentoss`.`catalog_product_option_type_value`, CONSTRAINT `FK_CAT_PRD_OPT_TYPE_VAL_OPT_ID_CAT_PRD_OPT_OPT_ID` FOREIGN KEY (`option_id`) REFERENCES `catalog_product_option` (`option_id`) ON D), query was: INSERT INTO `catalog_product_option_type_value` (`option_type_id`,`sort_order`,`sku`,`option_id`) VALUES (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)

检查产品列表后,文件似乎已上传,因为我的所有数据都已更新,所以不完全确定发生了什么。

于 2015-09-22T14:18:27.287 回答