How to Solve Reindexing Issue for Large Catalog in Magento

Magento Rindexing Issue for large Catalog

When we have large no. of products in our catalog, we generally found a problem that  when we do any changes from the admin panel or we use catalog import process to import the products, We see “No Products Matching This Selection” message on category pages at front end while that category has products and everything is fine in the admin panel to display the products on the frontend.

Cause of the problem:
This problem occur because magento does reindexing automatically when we import the products or do any changes in the admin panel on catalog because by default Indexing mode is set to “Update on Save”.

Solution:
One solution to this problem is set indexing mode to Manual from backend.You can change the indexing mode from
System->Index Management
Select all the Indexes and change the index mode to Manual Update from the drop down available at the top right corner of the grid.

Magento Rindexing Issue for large Catalog

But this solution does not fix the problem completely. Because It will not fix the problem of product importing process. It will only fix the problem of backend changes.

To resolve the issue completely,

1. Rewrite  startAction() method of  following controller

app/code/core/Mage/ImportExport/controllers/Adminhtml/ImportController.php

In this function’s try block add the following code in the beginning

$processes = Mage::getSingleton(‘index/indexer’)->getProcessesCollection();
$processes->walk(‘setMode’, array(Mage_Index_Model_Process::MODE_MANUAL));
$processes->walk(‘save’);

 

So your code should be like this

 

2. Copy  app/code/core/Mage/CatalogRule/Model/Rule.php in the local directory.

find applyAllRulesToProduct() function on approx 280 line.

Comment below 3 lines of this function

So now code should be like