Update Magento index for one or more specific products

Update Magento index for one or more specific products

August 9, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Update Magento index for one or more specific products

Updating Magento Index for Specific Products

In this post, we’ll explore how to update a specific index for one or more products in your Magento store. This is particularly useful when you’ve made changes to product data like price, inventory, or SEO attributes and need the index to reflect those updates.

Identifying the Problem

Let’s first understand the challenge at hand. You know how to update all indexes for a single product:

Mage::getSingleton('index/indexer')->processEntityAction(
  $product,
  Mage_Catalog_Model_Product::ENTITY,
  Mage_Index_Model_Event::TYPE_SAVE
);

And you also know how to reindex everything under a specific index, such as the price index:

$process = Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price');
$process->reindexEverything();

However, neither of these options directly solves your use case. You want to update only one specific index (e.g., catalog_product_price) for a list of product IDs.

The Solution: Custom Reindexing

To achieve this, we need to create a custom reindexing process. Here’s how you can do it:

Step 1: Get the Indexer Model

First, retrieve the specific indexer model you want to update. In your case, it would be the price indexer.

$indexer = Mage::getSingleton('catalog/index_price');

Step 2: Build the Reindex Action

Next, build an array containing the reindex action for each product ID in the list.

$actionList = array();
foreach ($productIds as $productId) {
    $actionList[] = array(
        'id' => $productId,
        'status' => Mage_Index_Model_Event::STATUS_REINDEX_NOW,
        'type' => Mage_Index_Model_Event::TYPE_SAVE
    );
}

Step 3: Execute the Reindex

Finally, execute the reindex using your custom indexer.

$indexer->processAction($actionList);

This will trigger an update of the catalog_product_price index for each product in the $productIds list.

An Alternative Approach

If you prefer a more direct approach, you can use the Mage_CatalogIndex_Model_Indexer model to perform a plain reindex operation. However, note that this method may not be available or may behave differently depending on your Magento version.

$indexer = Mage::getModel('catalogindex/indexer');
$indexer->plainReindex($productIds, Mage_CatalogIndex_Model_Indexer::REINDEX_TYPE_PRICE);

Conclusion

Updating specific indexes for multiple products in Magento requires a custom approach. By creating and executing an array of reindex actions using the appropriate indexer model, you can efficiently update only the necessary indexes without affecting the entire product catalog.

Remember to test this solution thoroughly in your development environment before deploying it to your live store.

For more advanced indexing and data management techniques, consider exploring the Laravel Company blog. We regularly publish posts covering Magento best practices, customizations, and performance optimization strategies.

Catalog Indexing Pricing SEO

Our network