Magento reindex via script does nothing

113 views Asked by At

I've create a controller and write an action to create a category, assign product to it and re-index data. Reindex code:

$processes = Mage::getSingleton('index/indexer')->getProcessesCollection();
$processes->walk('setMode', array(Mage_Index_Model_Process::MODE_REAL_TIME));
$processes->walk('save');
$processes->walk('reindexAll');
$processes->walk('reindexEverything');
echo "Reindex Data ok <br>";

Then I run it, it created some lock file in var/locks. In Admin/Catalog/Manage Category, I can see that my category have products on it, but when I go to this category on front-end, It say

There are no products matching the selection.

I have to run re-index script manually via command-line

php indexer.php --reindex category_catalog_product

Then I can see list of product in front-end. My question is, why re-index via PHP script does nothing? How can I re-index via "code-way"? I'm currently using Windows 8.1 Pro, XAMPP 1.8.2

0

There are 0 answers