In this post I will try to give a solution to one of the most common problems that any magento developer faces. The problem with re-indexing.
Whenever you need to reindex due to adding new products or any other such thing magento often tells you there was an error. The error is not displayed when working on the backend . You can anyways look at the error when working via ssh.
The one common solution to the error I have found to work for almost all problems regarding re-indexing is this: The catalog_product_flat tables do not get updated appropriately by magento and hence they must be truncated. So in this post I will try to give you a clear step by step guide on how to do so:
1) Go to system>configuration>catalog>front-end : Here set Use Flat_catalog_category and Flat_catlaog_product to no
2) Go to the index management page and change the mode of the tables to be re-indexed to manual update
3) Now ssh into your server. A detailed guide on how to do that is here.
4) Once in ssh you can do the jobs easily by installing a tool called n-98 magerun. You can find help here
5) Type ./n98-magerun.phar db:console to get a mysql command prompt where you can directly put your queries. Once you are here you must see a prompt like this:
mysql>
Happy Coding :D
Whenever you need to reindex due to adding new products or any other such thing magento often tells you there was an error. The error is not displayed when working on the backend . You can anyways look at the error when working via ssh.
The one common solution to the error I have found to work for almost all problems regarding re-indexing is this: The catalog_product_flat tables do not get updated appropriately by magento and hence they must be truncated. So in this post I will try to give you a clear step by step guide on how to do so:
1) Go to system>configuration>catalog>front-end : Here set Use Flat_catalog_category and Flat_catlaog_product to no
2) Go to the index management page and change the mode of the tables to be re-indexed to manual update
3) Now ssh into your server. A detailed guide on how to do that is here.
4) Once in ssh you can do the jobs easily by installing a tool called n-98 magerun. You can find help here
5) Type ./n98-magerun.phar db:console to get a mysql command prompt where you can directly put your queries. Once you are here you must see a prompt like this:
mysql>
6) Execute the following queries: a) SET FOREIGN_KEY_CHECKS = 0;
b) TRUNCATE TABLE catalog_product_flat_1; ( Do this for all the catalog_product_flat tables you have. If you don't know how many just keep doing it from 1,2 and so on until you get a no such table error)
c) SET FOREIGN_KEY_CHECKS =1;
7) Now manually reindex the tables. The general command to do this is:
> php indexer.php --reindex catalog_product_price
catalog_product_attribute - Product Attributes catalog_product_price - Product Prices catalog_url Catalog - Url Rewrites catalog_product_flat - Product Flat Data catalog_category_flat - Category Flat Data catalog_category_product - Category Products catalogsearch_fulltext - Catalog Search Index cataloginventory_stock - Stock status
