/*****************************************************************
How to get Configurable product Option by product Id
****************************************************************
require_once '../app/Mage.php';
Mage::app();
$product=Mage::getModel('catalog/product')->load(18);
/*$configurableAttributeCollection=$product->getTypeInstance()->getConfigurableAttributes();
foreach($configurableAttributeCollection as $attribute){
$attributeid = $attribute->getProductAttribute()->getId();
//echo "super:->".$attributeid."";
$new = $attributeid;
} */
$productAttributeOptions = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
$attributeOptions = array();
foreach ($productAttributeOptions as $productAttribute) {
echo $productAttribute['label']."";
echo $productAttribute['attribute_id']."-------"."";
foreach ($productAttribute['values'] as $attribute) {
echo "id:".$attribute['value_index']."price:".$attribute['pricing_value']. $attribute['store_label']."";
}
}
?>
Very helpful indeed!
ReplyDeleteThanks a lot :)