1

I want to reindex single product via programmatically. As i know, in enterprises edition there is update on save mode for product. It re-indexed the single product added via UI ( From admin ).

Is there any way to re-index single product programmatically ?

Also can anybody explain how reindex works on "Update on save" mode.

Any help would be appreciated !

Thanks in advance

9

After lot of debugging, i found the sound code which does reindex product by product id. Here is the way -

require_once('app/Mage.php');
umask(0);
Mage::app();
// Get products
$productsIds = array('11','222','3333'); // product id array

// Reindex category/product association
$event = Mage::getModel('index/event');
$event->setNewData(array(
    'product_ids' => &$productsIds // for category_indexer_product
));
Mage::getResourceSingleton('catalog/category_indexer_product')->catalogProductMassAction($event);

// Reindex prices
Mage::getResourceModel('catalog/product_indexer_price')->reindexProductIds($productsIds);

// Reindex stock
Mage::getResourceModel('cataloginventory/indexer_stock')->reindexProducts($productsIds);

// Reindex attributes
Mage::getResourceModel('catalog/product_indexer_eav_source')->reindexEntities($productsIds);

// Reindex fulltext
$catalogSearchIndexer = Mage::getResourceModel('catalogsearch/fulltext');
$catalogSearchIndexer->rebuildIndex(null, $productsIds);

Cheers !!!

  • I want to do indexing in magento 2.2.4 enterprise edition how can i do that? – Chirag Patel Oct 4 '18 at 6:00
  • How about the flat product table? Where is that? – Wouter Feb 25 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.