Daniel
Daniel

Reputation: 716

Magento - Rebuild Indexes without Index Management page?

Is it possible to run some code or change a setting which will automatically rebuild indexes when I log in or something similar?

The problem is any time I navigate to the Index Management I get the following error:

404 Error Page not found.

This problem seems to be popping up in multiple places in my admin view.

Thanks in advance.

Upvotes: 1

Views: 5178

Answers (4)

Hardik
Hardik

Reputation: 1283

Try to reindex using cron job.

You just need to add one cron job and it'll reindex as per your given time. Thanks,

Upvotes: 0

Ram Sharma
Ram Sharma

Reputation: 8819

You can create a new php file in root of the magento and paste the code below in file and run it manually or you can create an method to run on admin_session_user_login_success and add the code for re indexing of data.

include '/app/Mage.php';
Varien_Profiler::enable();
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app('default');
Mage::register('isSecureArea', 1);

for($i=1;$i<=9;$i++){
   Mage::getModel('index/process')->load($i)->reindexAll();
}

Upvotes: 2

Marius
Marius

Reputation: 15216

You shouldn't even reindex from the backend. You can do it from the command line:

> php shell/indexer.php reindexall

This will work, but you still need to sort out your problem. That page should not say 404.
Check the var/log folder for errors.

Upvotes: 1

Tuim
Tuim

Reputation: 2511

I suggest you fix the files, and do this via the admin interface.

However you can try this in the command line.

cd [MAGENTO_ROOT]/shell/
php indexer.php --status

This will show you the status of the indexer. After that you can run the following command:

php indexer.php --reindex catalog_product_attribute

This will reindex the catalog_product_attribute, do this for the others that you want to re-index aswell. Here is a list of arguments you can use

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

Upvotes: 4

Related Questions