Get the product custom option attributes in Magento


In this article get custom option of a product. Load product ID(here 100 is product id) and with the help foreach loop
print custom option title, custom option type, custom option value. 


Here is full code....
<?php
$pro = Mage::getModel("catalog/product")->load(100);

foreach ($pro->getOptions() as $printoption) {
    echo "This is Custom Option TITLE: " . $printoption->getTitle() . "<br/>";
    echo "This is Custom Option TYPE: " . $printoption->getType() . "<br/>";
    echo "This is Custom Option Values: <br/>";
    $optionval = $printoption->getValues();
    foreach ($optionval as $val) {
        print_r($val->getData());
    }
    echo "<br/>";
}
?>

Labels: