Display custom option on category list page in magento

I want to display custom product parameters on the product list page, and when I add it to the basket, it will go to the basket page.

+3
source share
2 answers

@mugur, Sorry, if the link above is missing, you can use the following code

$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 .= "";

  //$optStr .= $optionVal->getTitle().": ";

  $optStr .= "<select style="display: block; clear: both;" name="options[&quot;.$optionVal->getId().&quot;]">";

  foreach($optionVal->getValues() as $valuesKey => $valuesVal) {
    $optStr .= "<option value="&quot;.$valuesVal->getId().&quot;">".$valuesVal->getTitle()."</option>";
  }

 $optStr .= "</select>";

}

 echo($optStr);
+1
source

found a solution here finally. If someone needs to do the same, this can be done using the code in the theme.phtml file. Checck code here: http://blog.sparxitprofessionals.com/display-custom-option-on-category-list-page-in-magento/

+2
source

All Articles