Magento产品平面数据索引错误

时间:2015-07-12 13:06:15

标签: php magento zend-framework indexing magento-1.9

当我在shell中编入索引时,这就是我得到的。所有产品均以编程方式导入。系统配置中启用了平面类别。

  Product Attributes index was rebuilt successfully in 00:00:02
  Product Prices index was rebuilt successfully in 00:00:03
  Catalog URL Rewrites index was rebuilt successfully in 00:00:33
  Product Flat Data index process unknown error:
  exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`ethnx29_apexdeal`.`#sql-1300_4369b8c`, CONSTRAINT       `FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCAD)' in /home3/ethnx29/public_html/apexdeal.com/lib/Zend/Db/Statement/Pdo.php:228
  Stack trace:
  #0 /home3/ethnx29/public_html/apexdeal.com/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
  #1 /home3/ethnx29/public_html/apexdeal.com/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
  #2 /home3/ethnx29/public_html/apexdeal.com/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
  #3 /home3/ethnx29/public_html/apexdeal.com/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
  #4 /home3/ethnx29/public_html/apexdeal.com/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Array)
  #5 /home3/ethnx29/public_html/apexdeal.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
  #6 /home3/ethnx29/public_html/apexdeal.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(347): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ca...')
  #7 /home3/ethnx29/public_html/apexdeal.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(2731): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ca...')
  #8 /home3/ethnx29/public_html/apexdeal.com/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(815): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...',       'entity_id', 'CASCADE', 'CASCADE')
  #9 /home3/ethnx29/public_html/apexdeal.com/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1389): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
  #10 /home3/ethnx29/public_html/apexdeal.com/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
  #11 /home3/ethnx29/public_html/apexdeal.com/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(350): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
  #12 /home3/ethnx29/public_html/apexdeal.com/app/code/core/Mage/Index/Model/Process.php(212): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
  #13 /home3/ethnx29/public_html/apexdeal.com/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
  #14 /home3/ethnx29/public_html/apexdeal.com/shell/indexer.php(167): Mage_Index_Model_Process->reindexEverything()
  #15 /home3/ethnx29/public_html/apexdeal.com/shell/indexer.php(215): Mage_Shell_Compiler->run()
  #16 {main}
  Category Products index was rebuilt successfully in 00:00:04
  Catalog Search Index index was rebuilt successfully in 00:00:18
  Stock Status index was rebuilt successfully in 00:00:00
  Tag Aggregation Data index was rebuilt successfully in 00:00:00

1 个答案:

答案 0 :(得分:1)

在重新索引之前清除缓存并重命名平面数据表。它将使用正确的数据再次生成平面表