Select simple products of configurable product

<?php
 
$product = Mage::getModel('catalog/product')->load(127);
$confProduct = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
$simpleProductsCollection = $confProduct->getUsedProductCollection()
->addAttributeToSelect('*')
->addFilterByRequiredOptions();
 foreach($simpleProductsCollection as $simpleProduct) {
     var_dump($simpleProduct->getId());
 }

Leave a Reply