Friday 13 December 2013

get custom options programatically Magento

Hi with the below code you can get the product custom  option attributes all data


$product = Mage::getModel("catalog/product")->load(1); //product id 1
$i = 1;
echo "<pre>";
foreach ($product->getOptions() as $o) {
    echo "<strong>Custom Option:" . $i . "</strong><br/>";
    echo "Custom Option TITLE: " . $o->getTitle() . "<br/>"; //Colors
    echo "Custom Option TYPE: " . $o->getType() . "<br/>"; //drop_down
    echo "Custom Option Values: <br/>";
    $values = $o->getValues();
    foreach ($values as $v) {
        print_r($v->getData());
    }
    $i++;
    echo "<br/>";
}

1 comment: