Wednesday, 23 April 2014

Get Option Value by ID in Magento

<?php
$productModel = Mage::getModel('catalog/product');
$attr = $productModel->getResource()->getAttribute("manufacturer");

if ($attr->usesSource()) {
    echo $color_label = $attr->getSource()->getOptionText(45);
}
?>

Note:- manufacturer (product attribute code)
            45 ==> (option value id)

No comments:

Post a Comment