Get simple products belonging to configurable product AFTER configurable product save

Get simple products belonging to configurable product AFTER configurable product save

July 7, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Get simple products belonging to configurable product AFTER configurable product save

Getting Updated Simple Products of Configurable Product After Save Operation

In Magento, it’s quite common to retrieve associated simple products for a configurable product using the getUsedProducts() method provided by the catalog/product_type_configurable model. However, when calling this method from an event observer triggered by catalog_product_save_after, you might encounter issues where the returned list reflects the state before the save operation.

The problem arises because Magento doesn’t automatically update the cache or recalculate the configuration after a configurable product is saved. As a result, the getUsedProducts() call provides the stale data instead of the updated list.

To solve this issue and fetch the latest simple products associated with a configurable product after it’s been saved, you need to manually trigger the configuration process again. Here’s how you can achieve this:

public function afterProductSave(Varien_Event_Observer $observer)
{
    $_product = $observer->getProduct();
    if ($_product->isConfigurable()) {
        Mage::dispatchEvent('catalog_product_type_prepare_full_action',
            array('product' => $_product, 'action' => 'save'));
    }
}

In this solution:

  1. We check if the saved product is of type configurable using isConfigurable().
  2. If it is, we dispatch a custom event catalog_product_type_prepare_full_action with parameters indicating that the action performed was a save.

This event triggers Magento’s internal process to prepare and update the configuration for the given configurable product, recalculating all associated data including simple product assignments.

After triggering this event, you can then call the getUsedProducts() method again:

$childProducts = Mage::getModel('catalog/product_type_configurable')
    ->getUsedProducts(null, $_product);

Now $childProducts will hold the updated list of simple products associated with the configurable product after the save operation.

Conclusion

When dealing with configurable products in Magento, it’s important to understand that the framework doesn’t always update related data immediately after a save. In cases like this, you need to manually trigger the appropriate internal processes to ensure your data is up-to-date.

Remember to dispatch events at the correct time and check for product types before making assumptions about their behavior. This will help you avoid unexpected results and maintain data integrity in your Magento store.

To learn more about event observer best practices and Magento’s internal workings, I recommend exploring our detailed guides on Magento Event Observers and the official Magento documentation.

Catalog Cache Security Extensions

Our network