$_product = Mage::getModel('catalog/product')->load(877);
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $_product);
foreach ($childProducts as $key => $value) {
        echo "<pre>";print_r($value->getData());
}

Get Configurable product’s Children’s (simple product) custom attributes

$_product = Mage::getModel('catalog/product')->load(877);
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$col = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($col as $simple_product){
	echo "<pre>";print_r($simple_product->getId());
}die("Stop here..!");

Get Simple Products of a Configurable Product

<?php
$_product = Mage::getModel('catalog/product')->load(877);
if($_product->getTypeId() == "configurable") {
    $ids = $_product->getTypeInstance()->getUsedProductIds();
    foreach ($ids as $id) {
        $simpleproduct = Mage::getModel('catalog/product')->load($id);
        echo "<pre>";print_r($simpleproduct->getData());
    }die("Stop here..");
}
?>

 

credit Matthias Kleine

Be kind to one another. Take care!

No Comments

Post A Comment