cancel
Showing results for 
Search instead for 
Did you mean: 

Get attributes from child product of a configurable product

Get attributes from child product of a configurable product

Hello,

 

How I get attributes from a child of a configurable product?

 

Best Regards,

1 REPLY 1

Re: Get attributes from child product of a configurable product

I have preferred to use following code to get attributes for each child product

$ids=Mage::getResourceSingleton('catalog/product_type_configurable')
            ->getChildrenIds($parentId);


      $_subproducts = Mage::getModel('catalog/product')-
>getCollection()
                     ->addIdFilter ($ids)
    $attributes = $_subproducts->getAttributes(); foreach ($attributes as $attribute) {
    if ($attribute->getIsVisibleOnFront()) {
        $value = $attribute->getFrontend()->getValue($product);
        // do something with $value here
    }
}

thanks