【问题标题】:Category product re-indexing not working in magento 1.8类别产品重新索引在 magento 1.8 中不起作用
【发布时间】:2015-03-30 11:58:09
【问题描述】:

我来了

违反完整性约束:1452 无法添加或更新子行: 外键约束失败 (database_name.catalog_category_product_index, 约束 FK_CAT_CTGR_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID 外键 (product_id) REFERENCES catalog_product_entity (entity_id) ON DEL)' in /home/digitales/public_html/lib/Zend/Db/Statement/Pdo.php:234 错误 同时在 Magento 中重新索引 Category 产品。

我正在使用命令行中的 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 结果。

谢谢, 仁

【问题讨论】:

    标签: php mysql magento indexing


    【解决方案1】:

    我建议运行 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-15
      • 1970-01-01
      • 1970-01-01
      • 2014-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多