Skip to content

Instantly share code, notes, and snippets.

@insaurabh
Created August 24, 2018 06:45
Show Gist options
  • Save insaurabh/cdecb56e752eff0c936beae173735c34 to your computer and use it in GitHub Desktop.
Save insaurabh/cdecb56e752eff0c936beae173735c34 to your computer and use it in GitHub Desktop.
Magento 1.9 CLI commands | re-indexing | catalog_category_flat | catalog_category_product | catalogsearch_fulltext | reindexall
These is Individual commands for re-indexing:-
php shell/indexer.php --reindex catalog_category_flat
php shell/indexer.php --reindex catalog_category_product
php shell/indexer.php --reindex catalogsearch_fulltext
OR run all re-indexing:-
php shell/indexer.php --reindexall
==========================================================================================================================
OR script to do the same if no access to cli
<?php
require_once("app/Mage.php");
Mage::app('default');
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
try{
$indexerByShell = Mage::getBaseDir().'/shell/indexer.php';
if(file_exists($indexerByShell))
{
$indexListByCode = array(
"catalog_product_attribute",
"catalog_product_price",
"catalog_product_flat",
"catalog_category_flat",
"catalog_category_product",
"catalog_url",
"catalogsearch_fulltext",
"cataloginventory_stock"
);
//reindex using magento command line
foreach($indexListByCode as $indexer)
{
echo "reindex $indexer \n ";
exec("php $indexerByShell --reindex $indexer");
}
}
}catch(Exception $e){
echo $e;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment