Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Tuesday, January 19, 2016

Magento Product Flat Data will not reindex

Magento Product Flat Data will not reindex


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`., 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}  

Answer by BrettAdamsGA for Magento Product Flat Data will not reindex


I found a way to fix my own problem.

Using phpMyAdmin locate the catalog_product_flat_1 table in your Magento database. Then Empty (Truncate) that table, then using the indexer.php script in the shell directory in the root of your Magento install, reindex the Catalog Search Index through SSH.

The command should look like this once you are in the 'shell' directory php indexer.php --reindex catalogsearch_fulltext

Answer by Nithin for Magento Product Flat Data will not reindex


The catalog_product_flat_# table is a flat table containing data from EAV product catalog tables. If you have problem with reindexing the catalog, truncate (drop the content) that table and reindex your data.

It seems that Magento doesn?t clean that table when you delete some information.

In my case, that table was full of old deleted products.

Fixed it for me!

Answer by wjhulzebosch for Magento Product Flat Data will not reindex


I had the same problem and because i didn't have shell access, i didn't try to solve it, until next week. An error forced me to fix the problem. I've tried what everybody said, drop the table, etc.: it didn't work. What did the trick for me was this: The flat table is created to speed up the shop. Some, but not all, attributes are stored in the flat-table. However, all the attributes that have "Used in Product Listing" = "yes" are stored in the table. We have a lot of attributes (we use them to display specifications of our products) and apperantly, they where all set to be used in product listing. The problem was that because we have a lot of different attributes, the flat-table would become to large.

Setting all but the neccessery attributes to "no" on "Used in Product Listing" was a pain, however, the flat-table was created without errors, 5 minutes after i'd finished. So before you go and drop tables and ask you host for shell acces etc, see if you haven't made the same mistake as i had, back when i first set up my store.

Answer by user2550213 for Magento Product Flat Data will not reindex


Hey I had the same problem and nothing fixed it. WIth Mage 1.7 , I simply went to the admin/system/configuration/catalog then "frontend", switched Use Flat Catalog Product to "Yes". Reindex worked. Then back there, switched it back to "no". Reindex again, it worked. Hope it helps :D

PS : I don't know if it is related, but I did truncate the catalog_product_fat tables, and empty var folder before (it didn't change anything until I did what's up there, tho)

PS 2 : Problem initially happened after my Reindex timed out.

Answer by zeki893 for Magento Product Flat Data will not reindex


I flushed cache storage and thankfully reindex worked for me.


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.