Magento uses a powerful technique of indexing to revolutionize data such as product, category details, and so on, to increase the performance of the online store. When the data is updated, Magento must re-index the data in-order to make the online store work faster.
Indexing does not alter your existing data, it just grabs the data and copies it to its own database tables. Magento is a complex cart and has to do a number of calculations, so this essentially caches the data so that it can be processed faster, speeding up your website.
For example: If the website administrator updates the price of a product from $20 to $15 then they have to re-index the data so the new value is stored in the indexed tables. If re-indexing process is not done, the calculations for the products added to the shopping cart have to be done on the fly and sometimes it can result in desertion of the shopping cart because of this delay in processing.
Re-indexing can be done 2 ways:
If you have a large amount of products, you can re-index your web store with this PHP script:
<?php require_once 'app/Mage.php'; $app = Mage::app('admin'); umask(0); for ($index = 1; $index <= 9; $index++) { $process = Mage::getModel('index/process')->load($index); $process->reindexAll(); echo "Indexing for Process ID # ".$index." Done "; } ?>
Save the file as reindex.php and upload it to the website root and execute the file using this URL in your browser (replacing "yourdoman.com" with your actual domain name): https://yourdomain.com/reindex.php
If you don’t get the success message, then there is a problem with indexing - meaning the previous indexing process was abandoned before completion.
There are many reasons that may break the reindexing process in Magento:
You can increase the execution time value using the .htaccess file in your website root. You would edit it to at least have these values:
php_value memory_limit 128M php_value max_execution_time 18000
Magento creates ".lock" files in the folder named "lock" from the root directory and these files will be deleted after the indexing process is completed. If the indexing process abandoned during its process, these files will remain in the "lock" folder and it will create issues in the next Indexing process. To solve this, you have to manually remove those files using FTP.
Now run the re-indexing process. You should get the success message.