B-219 Sec-55 Noida, India
+918010221733

Fetch configurable product attributes values

Getting all options of a specific magento configurable product attribute is fairly easy:


getAttribute('catalog_product', 'color');
foreach ($attribute->getSource()->getAllOptions(true) as $option) {
echo $option['value'] . ' ' . $option['label'] . "n";
}
?>

get options and their values which are applicable to a particular configurable product


getTypeInstance(true)->getConfigurableAttributesAsArray($product);
$attributeOptions = array();
foreach ($productAttributeOptions as $productAttribute) {
foreach ($productAttribute['values'] as $attribute) {
$attributeOptions[$productAttribute['label']][$attribute['value_index']] = $attribute['store_label'];
}
}
?>

(Visited 57 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.