0

How can I add cutom options display in the product page: how add custom options I need to add custom options in product view pages, but I also need to display custom options in category pages.
What I want is to be able to select options and then add the product to the cart (user says it will be good). Please explain or let me know!

Thanks.

1 Answer 1

1

To get the custom option at categories page in magento show the feasibility and better access of product listing. to get the option need to use 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 .= "<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 );

Hope it will help you, and make sure your problem will solve: Thanks

3
  • thanks, but in details page i have checkbox, in catalog list custom options in dropdown list see, possible options are displayed as well as in details page? because in details page i have text field, checkboxes/radiobutton or textarea
    – John Genry
    May 12, 2014 at 9:01
  • Please specify your problem so that I can give you proper answer , I hope above code will help you :)
    – Ami Kamboj
    May 12, 2014 at 9:17
  • i update idea in this post, look please
    – John Genry
    May 12, 2014 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.