Magento 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


$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($attValas $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);


 

 

你可能感兴趣的:(display)