Monday, September 19, 2011

How to get configurable products attributes / super attributes details in magento?

   $productId = $_product->getId();
   $product=Mage::getModel("catalog/product")->load($prodcutId);
 
    /**
     * Get Configurable Type Product Instace and get Configurable attributes collection
     */
    $configurableAttributeCollection=$product->getTypeInstance()->getConfigurableAttributes();
 
    /**
     * Use the collection to get the desired values of attribute
     */
    foreach($configurableAttributeCollection as $attribute){
        echo "Attr-Code:".$attribute->getProductAttribute()->getAttributeCode()."
"; echo "Attr-Label:".$attribute->getProductAttribute()->getFrontend()->getLabel()."
"; echo "Attr-Id:".$attribute->getProductAttribute()->getId()."
"; }

No comments:

Post a Comment