类别产品重新索引在 magento 1.8 中不起作用
Category product re-indexing not working in magento 1.8
我得到
Integrity constraint violation: 1452 Cannot add or update a child row:
a foreign key constraint fails
(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 (entity_id) ON DEL)' in
/home/digitales/public_html/lib/Zend/Db/Statement/Pdo.php:234 error
while re-indexing Category product in 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 数据库修复工具,因为这将纠正许多常见的外键约束问题 and/or 缺失表。
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
我得到
Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (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 (entity_id) ON DEL)' in /home/digitales/public_html/lib/Zend/Db/Statement/Pdo.php:234 error while re-indexing Category product in 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 数据库修复工具,因为这将纠正许多常见的外键约束问题 and/or 缺失表。
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