I am having a problem with my Product Flat Index not reindexing, it only stays on processing. I went in and ran the reindex through the shell with indexer.php.
I get a error that I do not understand a bit of, can someone help me?
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 (`sprayfoa_store`.<result 2 when explaining filename '#sql-66c_ab044'>, CONSTRAINT `FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity`)' in /home/sprayfoa/public_html/store/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/sprayfoa/public_html/store/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/sprayfoa/public_html/store/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/sprayfoa/public_html/store/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/sprayfoa/public_html/store/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/sprayfoa/public_html/store/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Array)
#5 /home/sprayfoa/public_html/store/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
#6 /home/sprayfoa/public_html/store/lib/Varien/Db/Adapter/Pdo/Mysql.php(327): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ca...')
#7 /home/sprayfoa/public_html/store/lib/Varien/Db/Adapter/Pdo/Mysql.php(2548): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ca...')
#8 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(806): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(125): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
#10 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(115): Mage_Catalog_Model_Resource_Product_Flat_Indexer->rebuild('1')
#11 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(73): Mage_Catalog_Model_Resource_Product_Flat_Indexer->rebuild(NULL)
#12 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(303): Mage_Catalog_Model_Product_Flat_Indexer->rebuild()
#13 /home/sprayfoa/public_html/store/app/code/core/Mage/Index/Model/Process.php(159): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#14 /home/sprayfoa/public_html/store/app/code/core/Mage/Index/Model/Process.php(187): Mage_Index_Model_Process->reindexAll()
#15 /home/sprayfoa/public_html/store/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#16 /home/sprayfoa/public_html/store/shell/indexer.php(198): Mage_Shell_Compiler->run()
#17 {main}
I found a way to fix my own problem.
Using phpMyAdmin locate the
catalog_product_flat_1table in your Magento database. Then Empty (Truncate) that table, then using the indexer.php script in theshelldirectory in the root of your Magento install, reindex theCatalog Search Indexthrough SSH.The command should look like this once you are in the ‘shell’ directory
php indexer.php --reindex catalogsearch_fulltext