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]

Comments (4)

  1. sachin

    Thanks it very useful for development… thanks again

  2. shani

    Thanks man it works like a charm

  3. Boris

    Great work. Can you include the custom options price also i cannot get the customs options price working on the list.phtml file.

    1. priya

      How can i change product price, when i change custom options… ??

Leave a Comment

Your email address will not be published. Required fields are marked *

*