<?php
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customOptions = $_objectManager->get('Magento\Catalog\Model\Product\Option')->getProductOptionCollection($_product);
$optStr = "";
foreach($customOptions as $optionKey => $optionVal):
$optStr .= "<div class='custom-options'><label>".$optionVal->getTitle()." </label>";
$optStr .= "<select name='options[".$optionVal->getId()."]'>";
foreach($optionVal->getValues() as $valuesKey => $valuesVal) {
$optStr .= "<option value='".$valuesVal->getId()."'>".$valuesVal->getTitle()."</option>";
}
$optStr .= "</select></div>";
endforeach;
echo($optStr );
?>
No comments:
Post a Comment