For Creating the Custom Option of a simple products Select the products for which you want to create the Custom Options like the Color and Size Navigate to the Catalog –> Manage Products –> Select The Products from the Product Grid and Select Custom Options from the left menu (Extreme below) then click on the Add New Option Buttons on the Right Side. Refere the Screenshot below:
The code below is to get the all the custom options of a product. Here I am fetching the custom attributes of the products which have the Id 100.
<?php $productCollection = Mage::getModel("catalog/product")->load(100); $i = 1; foreach ($productCollection->getOptions() as $value) { echo "<strong>Custom Option:" . $i . "</strong><br/>"; echo "Custom Option TYPE: " . $value->getType() . "<br/>"; echo "Custom Option TITLE: " . $value->getTitle() . "<br/>"; echo "Custom Option Values: <br/>"; // Getting Values if it has option values, case of select,dropdown,radio,multiselect $values = $value->getValues(); foreach ($values as $values) { print_r($values->getData()); } $i++; } ?>
Hope this will be helpful to someone. Enjoy and Happy Coding in Maganto