[英]Category product re-indexing not working in magento 1.8
我正进入(状态
违反完整性约束:1452无法添加或更新子行:外键约束失败(database_name.catalog_category_product_index,CONSTRAINT FK_CAT_CTGR_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY(product_id)REFERENCES catalog_product_entity /Db/Statement/Pdo.php:234在Magento中重新索引类别产品时出错。
我正在从命令行使用php indexer.php --reindex catalog_category_product命令重新索引。
我已经尝试查询-
SELECT * FROM catalog_category_product WHERE
product_id not in (select entity_id from catalog_product_entity);
给出0个结果。
也尝试过
SELECT * FROM catalog_category_product WHERE
category_id not in (select entity_id from catalog_category_entity);
这也给0结果。
谢谢仁
我建议运行Magento DB修复工具,因为这将纠正许多常见的外键约束问题和/或缺少表。
http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool
您极有可能删除了产品,然后在Catalog_Category_Product_Index中留下了导致其失败的内容。 首先运行数据库备份,然后在数据库上运行以下选择:
SELECT * FROM Catalog_Category_Product_Index WHERE product_id IN (SELECT entity_id FROM Catalog_Product_Entity)
从数据库中删除这些行,索引过程应该正常工作。
以下内容可以帮助您更详细地了解该错误:
读取FK_CAT_CTGR_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID
描述了以下内容:
FK -> Foreign Key
CAT_CTGR_PRD_IDX -> Table Catalog_Category_Product_Index
PRD_ID -> Column Product_ID from Catalog_Category_Product_Index
CAT_PRD_ENTT -> Table Catalog_Product_Entity
ENTT_ID -> Column Entity_ID from Catalog_Product_Entity
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.