Oct 22, 2014

Posted by in Magento, Technology | 0 comments

Get simple product details for a given configurable product id in Magento

We can use the following code to get all associated simple products for a given configurable proudct in Magento.
$product = Mage::getModel('catalog/product')->load(CONFIG_PROD_ID); //replace CONFIG_PROD_ID with correct variable/value
$associatedProducts = Mage::getModel('catalog/product_type_configurable')
                    ->getUsedProducts(null,$product);

foreach($associatedProducts as $_product) {
    print_r($_product->getName());  // You can use any of the magic get functions on this object to get the value
}
You may also use the following code – but that will fetch only associated product ids
$associatedProducts = Mage::getModel('catalog/product_type_configurable')
                    ->getChildrenIds(CONFIG_PROD_ID);

Leave a Reply