How To Display Product Custom Option On list.phtml
Some time we need to display custom option of product on category list page
to achive this task we only need to paste the code given below in your list.phtml file
[php]
$productSku = $_product->getSku();
$product = Mage::getModel(‘catalog/product’);
$productId = $product->getIdBySku( $productSku );
$product = Mage::getModel("catalog/product")->load($productId);
$attVal = $product->getOptions();
$optStr = "";
// loop through the options
foreach($attVal as $optionKey => $optionVal) {
//$optStr .= "<br/>";
//$optStr .= $optionVal->getTitle().": ";
$optStr .= "<select style=’display:block; clear:both;’ name=’options[".$optionVal->getId()."]’>";
foreach($optionVal->getValues() as $valuesKey => $valuesVal) {
$optStr .= "<option value=’".$valuesVal->getId()."’>".$valuesVal->getTitle()."</option>";
}
$optStr .= "</select>";
}
echo($optStr ); [/php]
Thanks it very useful for development… thanks again
Thanks man it works like a charm
Great work. Can you include the custom options price also i cannot get the customs options price working on the list.phtml file.
How can i change product price, when i change custom options… ??