public function getValuesHtml()
 {
     $_option = $this->getOption();
     $helper = Mage::helper('customoptions');
     $displayQty = $helper->canDisplayQtyForOptions();
     $outOfStockOptions = $helper->getOutOfStockOptions();
     $enabledInventory = $helper->isInventoryEnabled();
     $enabledDependent = $helper->isDependentEnabled();
     $enabledSpecialPrice = $helper->isSpecialPriceEnabled();
     if (version_compare(Mage::getVersion(), '1.5.0', '>=') && version_compare(Mage::getVersion(), '1.9.0', '<') || version_compare(Mage::getVersion(), '1.10.0', '>=')) {
         $configValue = $this->getProduct()->getPreconfiguredValues()->getData('options/' . $_option->getId());
     } else {
         $configValue = false;
     }
     $buyRequest = false;
     $quoteItemId = 0;
     if ($helper->isQntyInputEnabled() && Mage::app()->getRequest()->getControllerName() != 'product') {
         $quoteItemId = (int) $this->getRequest()->getParam('id');
         if ($quoteItemId) {
             if (Mage::app()->getStore()->isAdmin()) {
                 $item = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getItemById($quoteItemId);
             } else {
                 $item = Mage::getSingleton('checkout/cart')->getQuote()->getItemById($quoteItemId);
             }
             if ($item) {
                 $buyRequest = $item->getBuyRequest();
                 if ($_option->getType() != Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
                     $optionQty = $buyRequest->getData('options_' . $_option->getId() . '_qty');
                     $_option->setOptionQty($optionQty);
                 }
             }
         }
     }
     if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
         $require = '';
         if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $require = ' hidden';
         }
         if ($_option->getIsRequire(true)) {
             if ($enabledDependent && $_option->getIsDependent()) {
                 $require .= ' required-dependent';
             } else {
                 $require .= ' required-entry';
             }
         }
         $extraParams = $enabledDependent && $_option->getIsDependent() ? ' disabled="disabled"' : '';
         $select = $this->getLayout()->createBlock('core/html_select')->setData(array('id' => 'select_' . $_option->getId(), 'class' => $require . ' product-custom-option' . ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH ? ' swatch' : '')));
         if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH) {
             $select->setName('options[' . $_option->getid() . ']')->addOption('', $this->__('-- Please Select --'));
         } else {
             $select->setName('options[' . $_option->getid() . '][]');
             $select->setClass('multiselect' . $require . ' product-custom-option');
         }
         $imagesHtml = '';
         $showImgFlag = false;
         $setProdutQtyJs = '';
         foreach ($_option->getValues() as $_value) {
             $qty = '';
             $customoptionsQty = $helper->getCustomoptionsQty($_value->getCustomoptionsQty(), $_value->getSku(), $this->getProduct()->getId(), $_value, $quoteItemId);
             if ($enabledInventory && $outOfStockOptions == 1 && ($customoptionsQty === 0 || $_value->getIsOutOfStock())) {
                 continue;
             }
             $selectOptions = array();
             $disabled = '';
             if ($enabledInventory && $customoptionsQty === 0 && $outOfStockOptions == 0) {
                 $selectOptions['disabled'] = $disabled = 'disabled';
             }
             $selected = '';
             if ($_value->getDefault() == 1 && !$disabled && !$configValue) {
                 if (!$enabledDependent || !$_option->getIsDependent()) {
                     $selectOptions['selected'] = $selected = 'selected';
                 }
             } elseif ($configValue) {
                 $selected = is_array($configValue) && in_array($_value->getOptionTypeId(), $configValue) ? 'selected' : '';
             }
             if ($enabledInventory) {
                 if ($displayQty && substr($customoptionsQty, 0, 1) != 'x' && $customoptionsQty !== '') {
                     $qty = ' (' . ($customoptionsQty > 0 ? $customoptionsQty : $helper->__('Out of stock')) . ')';
                 }
                 if (substr($customoptionsQty, 0, 1) == 'x') {
                     if (!$setProdutQtyJs) {
                         $setProdutQtyJs = 'optionSetQtyProductData[' . $_option->getId() . '] = [];';
                     }
                     $setProdutQtyJs .= 'optionSetQtyProductData[' . $_option->getId() . '][' . $_value->getOptionTypeId() . ']=' . intval(substr($customoptionsQty, 1)) . ';';
                 }
             }
             if ($setProdutQtyJs) {
                 $setProdutQtyFunc = 'optionSetQtyProduct.setQty();';
             } else {
                 $setProdutQtyFunc = '';
             }
             $priceStr = $helper->getFormatedOptionPrice($this->getProduct(), $_option, $_value);
             // swatch
             if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
                 $images = $_value->getImages();
                 if (count($images) > 0) {
                     $showImgFlag = true;
                     if ($disabled) {
                         $onClick = 'return false;';
                         $className = 'swatch swatch-disabled';
                     } else {
                         $onClick = 'optionSwatch.select(' . $_option->getId() . ', ' . $_value->getOptionTypeId() . '); return false;';
                         $className = 'swatch';
                     }
                     if ($buyRequest) {
                         $optionValueQty = $buyRequest->getData('options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty');
                     } else {
                         $optionValueQty = 0;
                     }
                     $image = $images[0];
                     if ($image['source'] == 1) {
                         // file
                         $arr = $helper->getImgHtml($image['image_file'], false, false, true);
                         if (isset($arr['big_img_url'])) {
                             $imagesHtml .= '<li id="swatch_' . $_value->getOptionTypeId() . '" class="' . $className . '">' . '<a href="' . $arr['big_img_url'] . '" onclick="' . $onClick . '">' . '<img src="' . $arr['url'] . '" title="' . $this->htmlEscape($_value->getTitle() . ' - ' . strip_tags(str_replace(array('<s>', '</s>'), array('(', ')'), $priceStr))) . '" class="swatch small-image-preview v-middle" />' . '</a>' . ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH ? '<br/><label><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input type="text" class="input-text qty' . ($selected ? ' validate-greater-than-zero' : '') . '" value="' . $optionValueQty . '" maxlength="12" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" onchange="' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . '" onKeyPress="if(event.keyCode==13){' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();' . $setProdutQtyFunc) . '}" ' . ($selected ? $disabled : 'disabled') . '></label>' : '') . '</li>';
                         }
                     } elseif ($image['source'] == 2) {
                         // color
                         $imagesHtml .= '<li id="swatch_' . $_value->getOptionTypeId() . '" class="' . $className . '">' . '<a href="#" onclick="' . $onClick . '">' . '<div class="swatch container-swatch-color small-image-preview v-middle"" title="' . $this->htmlEscape($_value->getTitle() . ' - ' . strip_tags(str_replace(array('<s>', '</s>'), array('(', ')'), $priceStr))) . '">' . '<div class="swatch-color" style="background:' . $image['image_file'] . ';">&nbsp;</div>' . '</div>' . '</a>' . ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH ? '<br/><label><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input type="text" class="input-text qty' . ($selected ? ' validate-greater-than-zero' : '') . '" value="' . $optionValueQty . '" maxlength="12" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" onchange="' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . '" onKeyPress="if(event.keyCode==13){' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();' . $setProdutQtyFunc) . '}" ' . ($selected ? $disabled : 'disabled') . '></label>' : '') . '</li>';
                     }
                 }
             } else {
                 if (!$imagesHtml && $_value->getImages()) {
                     $showImgFlag = true;
                     if ($_option->getImageMode() == 1 || $_option->getImageMode() > 1 && $_option->getExcludeFirstImage()) {
                         $imagesHtml = '<div id="customoptions_images_' . $_option->getId() . '" class="customoptions-images-div" style="display:none"></div>';
                     }
                 }
             }
             $select->addOption($_value->getOptionTypeId(), $_value->getTitle() . ' ' . $priceStr . $qty, $selectOptions);
         }
         if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $extraParams .= ' multiple="multiple"';
         }
         if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $extraParams .= ' style="float: left; height: 1px;"';
         }
         if ($showImgFlag) {
             $showImgFunc = 'optionImages.showImage(this);';
         } else {
             $showImgFunc = '';
         }
         if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $showImgFunc .= ' optionSwatch.change(this)';
         }
         $select->setExtraParams('onchange="' . ($enabledDependent ? 'dependentOptions.select(this); ' : '') . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . $showImgFunc . '"' . $extraParams);
         if ($configValue) {
             $select->setValue($configValue);
         }
         if (count($select->getOptions()) > 1 && ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH) || count($select->getOptions()) > 0 && ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH)) {
             $outHTML = $select->getHtml();
             if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
                 $outHTML = '<ul id="ul_swatch_' . $_option->getId() . '">' . $imagesHtml . '</ul>' . $outHTML;
             } else {
                 if ($imagesHtml) {
                     if ($helper->isImagesAboveOptions()) {
                         $outHTML = $imagesHtml . $outHTML;
                     } else {
                         $outHTML .= $imagesHtml;
                     }
                 }
             }
             if ($setProdutQtyJs) {
                 $outHTML .= '<script type="text/javascript">' . $setProdutQtyJs . 'optionSetQtyProduct.hideQty();</script>';
                 $_option->setOptionSetQtyProduct(1);
             }
             return $outHTML;
         }
     } elseif ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
         $selectHtml = '';
         $setProdutQtyJs = '';
         $require = '';
         if ($_option->getIsRequire(true)) {
             if ($enabledDependent && $_option->getIsDependent()) {
                 $require = ' required-dependent';
             } else {
                 $require = ' validate-one-required-by-name';
             }
         }
         $arraySign = '';
         switch ($_option->getType()) {
             case Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO:
                 $type = 'radio';
                 $class = 'radio';
                 break;
             case Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX:
                 $type = 'checkbox';
                 $class = 'checkbox';
                 $arraySign = '[]';
                 break;
         }
         $count = 0;
         foreach ($_option->getValues() as $_value) {
             $count++;
             $priceStr = $helper->getFormatedOptionPrice($this->getProduct(), $_option, $_value);
             $qty = '';
             $customoptionsQty = $helper->getCustomoptionsQty($_value->getCustomoptionsQty(), $_value->getSku(), $this->getProduct()->getId(), $_value, $quoteItemId);
             if ($enabledInventory && $outOfStockOptions == 1 && ($customoptionsQty === 0 || $_value->getIsOutOfStock())) {
                 continue;
             }
             $inventory = $enabledInventory && $customoptionsQty === 0 ? false : true;
             $disabled = !$inventory && $outOfStockOptions == 0 || $enabledDependent && $_option->getIsDependent() ? 'disabled="disabled"' : '';
             if ($enabledInventory) {
                 if ($displayQty && substr($customoptionsQty, 0, 1) != 'x' && $customoptionsQty !== '') {
                     $qty = ' (' . ($customoptionsQty > 0 ? $customoptionsQty : $helper->__('Out of stock')) . ')';
                 }
                 if (substr($customoptionsQty, 0, 1) == 'x') {
                     if (!$setProdutQtyJs) {
                         $setProdutQtyJs = 'optionSetQtyProductData[' . $_option->getId() . '] = [];';
                     }
                     $setProdutQtyJs .= 'optionSetQtyProductData[' . $_option->getId() . '][' . $_value->getOptionTypeId() . ']=' . intval(substr($customoptionsQty, 1)) . ';';
                 }
             }
             if ($disabled && $enabledDependent && $helper->hideDependentOption() && $_option->getIsDependent()) {
                 $selectHtml .= '<li style="display: none;">';
             } else {
                 $selectHtml .= '<li>';
             }
             $imagesHtml = '';
             $images = $_value->getImages();
             if ($images) {
                 if ($_option->getImageMode() == 1) {
                     foreach ($images as $image) {
                         if ($image['source'] == 1) {
                             // file
                             $imagesHtml .= $helper->getImgHtml($image['image_file']);
                         } elseif ($image['source'] == 2) {
                             // color
                             $imagesHtml .= $this->getColorHtml($image['image_file']);
                         }
                     }
                 } elseif ($_option->getExcludeFirstImage()) {
                     $image = $images[0];
                     if ($image['source'] == 1) {
                         // file
                         $imagesHtml = $helper->getImgHtml($image['image_file']);
                     } elseif ($image['source'] == 2) {
                         // color
                         $imagesHtml = $this->getColorHtml($image['image_file']);
                     }
                 }
             }
             if ($configValue) {
                 if ($arraySign) {
                     $checked = is_array($configValue) && in_array($_value->getOptionTypeId(), $configValue) ? 'checked' : '';
                 } else {
                     $checked = $configValue == $_value->getOptionTypeId() ? 'checked' : '';
                 }
             } else {
                 $checked = $_value->getDefault() == 1 && !$disabled ? 'checked' : '';
             }
             if ($setProdutQtyJs) {
                 $setProdutQtyFunc = 'optionSetQtyProduct.setQty();';
             } else {
                 $setProdutQtyFunc = '';
             }
             if ($checked) {
                 $setProdutQtyJs .= $setProdutQtyFunc;
             }
             if ($images && $_option->getImageMode() > 1) {
                 $showImgFunc = 'optionImages.showImage(this);';
             } else {
                 $showImgFunc = '';
             }
             $onclick = ($enabledDependent ? 'dependentOptions.select(this);' : '') . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . $showImgFunc;
             if ($_value->getTitle() == 'None') {
                 $checked = 'checked="checked" style="display:none;"';
                 $style = "style='display:none;'";
             } else {
                 $style = "";
             }
             if ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
                 if ($buyRequest) {
                     $optionValueQty = $buyRequest->getData('options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty');
                 } else {
                     $optionValueQty = 0;
                 }
                 if (!$optionValueQty && $checked) {
                     $optionValueQty = 1;
                 }
                 $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="optionSetQtyProduct.checkboxQty(this); ' . $onclick . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . $imagesHtml . '<span class="label">
                         <label  ' . $style . ' for="options_' . $_option->getId() . '_' . $count . '">' . $_value->getTitle() . ' ' . $priceStr . $qty . '</label>
                         &nbsp;&nbsp;&nbsp;
                         <label class="label-qty"><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input type="text" class="input-text qty' . ($checked ? ' validate-greater-than-zero' : '') . '" value="' . $optionValueQty . '" maxlength="12" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" onchange="' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();' . $setProdutQtyFunc) . '" onKeyPress="if(event.keyCode==13){' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . '}" ' . ($checked ? $disabled : 'disabled') . '></label>
                      </span>';
             } else {
                 $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="' . $onclick . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . $imagesHtml . '<span class="label"><label ' . $style . ' for="options_' . $_option->getId() . '_' . $count . '">' . $_value->getTitle() . ' ' . $priceStr . $qty . '</label></span>';
             }
             if ($_option->getIsRequire(true)) {
                 $selectHtml .= '<script type="text/javascript">' . '$(\'options_' . $_option->getId() . '_' . $count . '\').advaiceContainer = \'options-' . $_option->getId() . '-container\';' . '$(\'options_' . $_option->getId() . '_' . $count . '\').callbackFunction = \'validateOptionsCallback\';' . '</script>';
             }
             $selectHtml .= '</li>';
         }
         if ($selectHtml) {
             $selectHtml = '<ul id="options-' . $_option->getId() . '-list" class="options-list">' . $selectHtml . '</ul>';
         }
         self::$isFirstOption = false;
         if ($setProdutQtyJs) {
             $selectHtml .= '<script type="text/javascript">' . $setProdutQtyJs . ' optionSetQtyProduct.hideQty();</script>';
             $_option->setOptionSetQtyProduct(1);
         }
         return $selectHtml;
     }
 }
Example #2
0
 public function getValuesHtml()
 {
     $_option = $this->getOption();
     $helper = Mage::helper('customoptions');
     $displayQty = $helper->canDisplayQtyForOptions();
     $outOfStockOptions = $helper->getOutOfStockOptions();
     $enabledInventory = $helper->isInventoryEnabled();
     $enabledDependent = $helper->isDependentEnabled();
     $enabledSpecialPrice = $helper->isSpecialPriceEnabled();
     if (version_compare(Mage::getVersion(), '1.5.0', '>=') && version_compare(Mage::getVersion(), '1.9.0', '<') || version_compare(Mage::getVersion(), '1.10.0', '>=')) {
         $configValue = $this->getProduct()->getPreconfiguredValues()->getData('options/' . $_option->getId());
     } else {
         $configValue = false;
     }
     $buyRequest = false;
     $quoteItemId = 0;
     if ($helper->isQntyInputEnabled() && Mage::app()->getRequest()->getControllerName() != 'product') {
         $quoteItemId = (int) $this->getRequest()->getParam('id');
         if ($quoteItemId) {
             if (Mage::app()->getStore()->isAdmin()) {
                 $item = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getItemById($quoteItemId);
             } else {
                 $item = Mage::getSingleton('checkout/cart')->getQuote()->getItemById($quoteItemId);
             }
             if ($item) {
                 $buyRequest = $item->getBuyRequest();
                 if ($_option->getType() != Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
                     $optionQty = $buyRequest->getData('options_' . $_option->getId() . '_qty');
                     $_option->setOptionQty($optionQty);
                 }
             }
         }
     }
     if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
         $require = '';
         if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $require = ' hidden';
         }
         if ($_option->getIsRequire(true)) {
             if ($enabledDependent && $_option->getIsDependent()) {
                 $require .= ' required-dependent';
             } else {
                 $require .= ' required-entry';
             }
         }
         $extraParams = $enabledDependent && $_option->getIsDependent() ? ' disabled="disabled"' : '';
         $select = $this->getLayout()->createBlock('core/html_select')->setData(array('id' => 'select_' . $_option->getId(), 'class' => $require . ' product-custom-option' . ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH ? ' swatch' : '')));
         if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH) {
             $select->setName('options[' . $_option->getid() . ']')->addOption('', $this->__('-- Please Select --'));
         } else {
             $select->setName('options[' . $_option->getid() . '][]');
             $select->setClass('multiselect' . $require . ' product-custom-option');
         }
         $imagesHtml = '';
         $showImgFlag = false;
         $setProdutQtyJs = '';
         foreach ($_option->getValues() as $_value) {
             $qty = '';
             $customoptionsQty = $helper->getCustomoptionsQty($_value->getCustomoptionsQty(), $_value->getSku(), $this->getProduct()->getId(), $_value, $quoteItemId);
             if ($enabledInventory && $outOfStockOptions == 1 && ($customoptionsQty === 0 || $_value->getIsOutOfStock())) {
                 continue;
             }
             $selectOptions = array();
             $disabled = '';
             if ($enabledInventory && $customoptionsQty === 0 && $outOfStockOptions == 0) {
                 $selectOptions['disabled'] = $disabled = 'disabled';
             }
             $selected = '';
             if ($_value->getDefault() == 1 && !$disabled && !$configValue) {
                 if (!$enabledDependent || !$_option->getIsDependent()) {
                     $selectOptions['selected'] = $selected = 'selected';
                 }
             } elseif ($configValue) {
                 $selected = is_array($configValue) && in_array($_value->getOptionTypeId(), $configValue) ? 'selected' : '';
             }
             if ($enabledInventory) {
                 if ($displayQty && substr($customoptionsQty, 0, 1) != 'x' && $customoptionsQty !== '') {
                     $qty = ' (' . ($customoptionsQty > 0 ? $customoptionsQty : $helper->__('Out of stock')) . ')';
                 }
                 if (substr($customoptionsQty, 0, 1) == 'x') {
                     if (!$setProdutQtyJs) {
                         $setProdutQtyJs = 'optionSetQtyProductData[' . $_option->getId() . '] = [];';
                     }
                     $setProdutQtyJs .= 'optionSetQtyProductData[' . $_option->getId() . '][' . $_value->getOptionTypeId() . ']=' . intval(substr($customoptionsQty, 1)) . ';';
                 }
             }
             if ($setProdutQtyJs) {
                 $setProdutQtyFunc = 'optionSetQtyProduct.setQty();';
             } else {
                 $setProdutQtyFunc = '';
             }
             $priceStr = $helper->getFormatedOptionPrice($this->getProduct(), $_option, $_value);
             // swatch
             if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
                 $images = $_value->getImages();
                 if (count($images) > 0) {
                     $showImgFlag = true;
                     if ($disabled) {
                         $onClick = 'return false;';
                         $className = 'swatch swatch-disabled';
                     } else {
                         $onClick = 'optionSwatch.select(' . $_option->getId() . ', ' . $_value->getOptionTypeId() . '); return false;';
                         $className = 'swatch';
                     }
                     if ($buyRequest) {
                         $optionValueQty = $buyRequest->getData('options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty');
                     } else {
                         $optionValueQty = 0;
                     }
                     $image = $images[0];
                     if ($image['source'] == 1) {
                         // file
                         $arr = $helper->getImgHtml($image['image_file'], false, false, true);
                         if (isset($arr['big_img_url'])) {
                             $imagesHtml .= '<li id="swatch_' . $_value->getOptionTypeId() . '" class="' . $className . '">' . '<a href="' . $arr['big_img_url'] . '" onclick="' . $onClick . '">' . '<img src="' . $arr['url'] . '" title="' . $this->htmlEscape($_value->getTitle() . ' - ' . strip_tags(str_replace(array('<s>', '</s>'), array('(', ')'), $priceStr))) . '" class="swatch small-image-preview v-middle" />' . '</a>' . ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH ? '<br/><label><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input type="text" class="input-text qty' . ($selected ? ' validate-greater-than-zero' : '') . '" value="' . $optionValueQty . '" maxlength="12" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" onchange="' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . '" onKeyPress="if(event.keyCode==13){' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();' . $setProdutQtyFunc) . '}" ' . ($selected ? $disabled : 'disabled') . '></label>' : '') . '</li>';
                         }
                     } elseif ($image['source'] == 2) {
                         // color
                         $imagesHtml .= '<li id="swatch_' . $_value->getOptionTypeId() . '" class="' . $className . '">' . '<a href="#" onclick="' . $onClick . '">' . '<div class="swatch container-swatch-color small-image-preview v-middle"" title="' . $this->htmlEscape($_value->getTitle() . ' - ' . strip_tags(str_replace(array('<s>', '</s>'), array('(', ')'), $priceStr))) . '">' . '<div class="swatch-color" style="background:' . $image['image_file'] . ';">&nbsp;</div>' . '</div>' . '</a>' . ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH ? '<br/><label><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input type="text" class="input-text qty' . ($selected ? ' validate-greater-than-zero' : '') . '" value="' . $optionValueQty . '" maxlength="12" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" onchange="' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . '" onKeyPress="if(event.keyCode==13){' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();' . $setProdutQtyFunc) . '}" ' . ($selected ? $disabled : 'disabled') . '></label>' : '') . '</li>';
                     }
                 }
             } else {
                 if (!$imagesHtml && $_value->getImages()) {
                     $showImgFlag = true;
                     if ($_option->getImageMode() == 1 || $_option->getImageMode() > 1 && $_option->getExcludeFirstImage()) {
                         $imagesHtml = '<div id="customoptions_images_' . $_option->getId() . '" class="customoptions-images-div" style="display:none"></div>';
                     }
                 }
             }
             $select->addOption($_value->getOptionTypeId(), $_value->getTitle() . ' ' . $priceStr . $qty, $selectOptions);
         }
         if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $extraParams .= ' multiple="multiple"';
         }
         if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $extraParams .= ' style="float: left; height: 1px;"';
         }
         if ($showImgFlag) {
             $showImgFunc = 'optionImages.showImage(this);';
         } else {
             $showImgFunc = '';
         }
         if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $showImgFunc .= ' optionSwatch.change(this)';
         }
         $select->setExtraParams('onchange="' . ($enabledDependent ? 'dependentOptions.select(this); ' : '') . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . $showImgFunc . '"' . $extraParams);
         if ($configValue) {
             $select->setValue($configValue);
         }
         if (count($select->getOptions()) > 1 && ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH) || count($select->getOptions()) > 0 && ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH)) {
             $outHTML = $select->getHtml();
             if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
                 $outHTML = '<ul id="ul_swatch_' . $_option->getId() . '">' . $imagesHtml . '</ul>' . $outHTML;
             } else {
                 if ($imagesHtml) {
                     if ($helper->isImagesAboveOptions()) {
                         $outHTML = $imagesHtml . $outHTML;
                     } else {
                         $outHTML .= $imagesHtml;
                     }
                 }
             }
             if ($setProdutQtyJs) {
                 $outHTML .= '<script type="text/javascript">' . $setProdutQtyJs . 'optionSetQtyProduct.hideQty();</script>';
                 $_option->setOptionSetQtyProduct(1);
             }
             return $outHTML;
         }
     } elseif ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
         $selectHtml = '';
         $setProdutQtyJs = '';
         $require = '';
         if ($_option->getIsRequire(true)) {
             if ($enabledDependent && $_option->getIsDependent()) {
                 $require = ' required-dependent';
             } else {
                 $require = ' validate-one-required-by-name';
             }
         }
         $arraySign = '';
         switch ($_option->getType()) {
             case Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO:
                 $type = 'radio';
                 $class = 'radio';
                 break;
             case Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX:
                 $type = 'checkbox';
                 $class = 'checkbox';
                 $arraySign = '[]';
                 break;
         }
         $count = 0;
         foreach ($_option->getValues() as $_value) {
             $count++;
             $priceStr = $helper->getFormatedOptionPrice($this->getProduct(), $_option, $_value);
             $qty = '';
             $customoptionsQty = $helper->getCustomoptionsQty($_value->getCustomoptionsQty(), $_value->getSku(), $this->getProduct()->getId(), $_value, $quoteItemId);
             if ($enabledInventory && $outOfStockOptions == 1 && ($customoptionsQty === 0 || $_value->getIsOutOfStock())) {
                 continue;
             }
             $inventory = $enabledInventory && $customoptionsQty === 0 ? false : true;
             $disabled = !$inventory && $outOfStockOptions == 0 || $enabledDependent && $_option->getIsDependent() ? 'disabled="disabled"' : '';
             if ($enabledInventory) {
                 if ($displayQty && substr($customoptionsQty, 0, 1) != 'x' && $customoptionsQty !== '') {
                     $qty = ' (' . ($customoptionsQty > 0 ? $customoptionsQty : $helper->__('Out of stock')) . ')';
                 }
                 if (substr($customoptionsQty, 0, 1) == 'x') {
                     if (!$setProdutQtyJs) {
                         $setProdutQtyJs = 'optionSetQtyProductData[' . $_option->getId() . '] = [];';
                     }
                     $setProdutQtyJs .= 'optionSetQtyProductData[' . $_option->getId() . '][' . $_value->getOptionTypeId() . ']=' . intval(substr($customoptionsQty, 1)) . ';';
                 }
             }
             if ($disabled && $enabledDependent && $helper->hideDependentOption() && $_option->getIsDependent()) {
                 $selectHtml .= '<li style="display: none;">';
             } else {
                 $selectHtml .= '<li>';
             }
             $imagesHtml = '';
             $images = $_value->getImages();
             if ($images) {
                 if ($_option->getImageMode() == 1) {
                     foreach ($images as $image) {
                         if ($image['source'] == 1) {
                             // file
                             $imagesHtml .= $helper->getImgHtml($image['image_file']);
                         } elseif ($image['source'] == 2) {
                             // color
                             $imagesHtml .= $this->getColorHtml($image['image_file']);
                         }
                     }
                 } elseif ($_option->getExcludeFirstImage()) {
                     $image = $images[0];
                     if ($image['source'] == 1) {
                         // file
                         $imagesHtml = $helper->getImgHtml($image['image_file']);
                     } elseif ($image['source'] == 2) {
                         // color
                         $imagesHtml = $this->getColorHtml($image['image_file']);
                     }
                 }
             }
             if ($configValue) {
                 if ($arraySign) {
                     $checked = is_array($configValue) && in_array($_value->getOptionTypeId(), $configValue) ? 'checked' : '';
                 } else {
                     $checked = $configValue == $_value->getOptionTypeId() ? 'checked' : '';
                 }
             } else {
                 $checked = $_value->getDefault() == 1 && !$disabled ? 'checked' : '';
             }
             if ($setProdutQtyJs) {
                 $setProdutQtyFunc = 'optionSetQtyProduct.setQty();';
             } else {
                 $setProdutQtyFunc = '';
             }
             if ($checked) {
                 $setProdutQtyJs .= $setProdutQtyFunc;
             }
             if ($images && $_option->getImageMode() > 1) {
                 $showImgFunc = 'optionImages.showImage(this);';
             } else {
                 $showImgFunc = '';
             }
             $onclick = ($enabledDependent ? 'dependentOptions.select(this);' : '') . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . $showImgFunc;
             if ($_value->getTitle() == 'None') {
                 $checked = 'checked="checked" style="display:none;"';
                 $style = "style='display:none;'";
             } else {
                 $style = "";
             }
             $_product = $this->getProduct();
             $categoryIds = $_product->getCategoryIds();
             if (count($categoryIds)) {
                 $firstCategoryId = $categoryIds[0];
                 if ($firstCategoryId == 90) {
                     if ($count == 1) {
                         //echo "11";
                         $testhtml = "<span class=" . '"' . "mark_round" . '"' . ">\n\t\t\t\t\t<a onclick=" . '"' . "document.getElementById('light_popup').style.display='block';document.getElementById('fade').style.display='block'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . ">?</a></span>\n\t\t\t\t\t<div class=" . '"' . "product_content_popup" . '"' . " id=" . '"' . "light_popup" . '"' . "><a onclick=" . '"' . "document.getElementById('light_popup').style.display='none';document.getElementById('fade').style.display='none'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . " class=" . '"' . "close_button_option" . '"' . ">\n\t\t\t\t\t\n\t\t\t\t\t<img src=" . '"' . "http://www.sareez.com/skin/frontend/default/sareez/images/dialog_close.png" . '"' . "></a>\n\t\t\t\t\t<p class=" . '"' . "abcdef" . '"' . ">\n\t\t\t\t\tSaree comes with an unstitched blouse </br>\n\t\t\t\t\tpiece which needs to be stitched with </br>\n\t\t\t\t\texact measurement. The measurements, </br>\n\t\t\t\t\tdesign and cuts suggestion is solely </br>\n\t\t\t\t\tyours. You are free to design your </br>\n\t\t\t\t\tblouses in a way which will suit </br>\n\t\t\t\t\tyou best.</p>   \n\t\t\t\t\t\n\t\t\t\t\t</div> \n\t\t\t\t\t<div class=" . '"' . "black_overlay_popup" . '"' . " id=" . '"' . "fade" . '"' . "></div>\t\n\t\t\t\t\t\n\t\t\t\t\t<span class=" . '"' . "hr_lined" . '"' . "><img src=" . '"' . "http://magento-7350-19577-45479.cloudwaysapps.com/skin/frontend/default/sareez/images_001/horizontal-line.png" . '"' . ">\n\t\t\t\t\t</span>";
                     }
                     if ($count == 2) {
                         //echo "22";
                         $testhtml = "<span class=" . '"' . "mark_round" . '"' . ">\n\t\t\t\t\t<a onclick=" . '"' . "document.getElementById('light_popup1').style.display='block';document.getElementById('fade').style.display='block'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . ">?</a></span>\n\t\t\t\t\t<div class=" . '"' . "product_content_popup" . '"' . " id=" . '"' . "light_popup1" . '"' . "><a onclick=" . '"' . "document.getElementById('light_popup1').style.display='none';document.getElementById('fade').style.display='none'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . " class=" . '"' . "close_button_option" . '"' . ">\n\t\t\t\t\t\n\t\t\t\t\t<img src=" . '"' . "http://www.sareez.com/skin/frontend/default/sareez/images/dialog_close.png" . '"' . "></a>\n\t\t\t\t\t<p class=" . '"' . "abcdef" . '"' . ">\n\t\t\t\t\tPetticoat is the inner skirt worn </br>\n\t\t\t\t\tunder a saree to tuck in the saree.</br>\n\t\t\t\t\tThe max available size of standard </br>\n\t\t\t\t\tpetticoat is 36 to 38 inches in </br>\n\t\t\t\t\tlength and waist both.</p>   \n\t\t\t\t\t\n\t\t\t\t\t</div> \n\t\t\t\t\t<div class=" . '"' . "black_overlay_popup" . '"' . " id=" . '"' . "fade" . '"' . "></div>\t\n\t\t\t\t\t\n\t\t\t\t\t<span class=" . '"' . "hr_lined" . '"' . "><img src=" . '"' . "http://magento-7350-19577-45479.cloudwaysapps.com/skin/frontend/default/sareez/images_001/horizontal-line.png" . '"' . ">\n\t\t\t\t\t</span>";
                     }
                     if ($count == 3) {
                         //echo "33";
                         $testhtml = "<span class=" . '"' . "mark_round" . '"' . ">\n\t\t\t\t\t<a onclick=" . '"' . "document.getElementById('light_popup2').style.display='block';document.getElementById('fade').style.display='block'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . ">?</a></span>\n\t\t\t\t\t<div class=" . '"' . "product_content_popup" . '"' . " id=" . '"' . "light_popup2" . '"' . "><a onclick=" . '"' . "document.getElementById('light_popup2').style.display='none';document.getElementById('fade').style.display='none'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . " class=" . '"' . "close_button_option" . '"' . ">\n\t\t\t\t\t\n\t\t\t\t\t<img src=" . '"' . "http://www.sareez.com/skin/frontend/default/sareez/images/dialog_close.png" . '"' . "></a>\n\t\t\t\t\t<p class=" . '"' . "abcdef" . '"' . ">\n\t\t\t\t\tPetticoat or inner skirt can be </br>\n\t\t\t\t\tcustomised according to your </br>\n\t\t\t\t\theight and waist size as chosen </br>\n\t\t\t\t\tby you. The tailors can increase </br>\n\t\t\t\t\tthe length and the waist size </br>\n\t\t\t\t\tof the petticoat as desired.</p>   \n\t\t\t\t\t\n\t\t\t\t\t</div> \n\t\t\t\t\t<div class=" . '"' . "black_overlay_popup" . '"' . " id=" . '"' . "fade" . '"' . "></div>\t\n\t\t\t\t\t\n\t\t\t\t\t<span class=" . '"' . "hr_lined" . '"' . "><img src=" . '"' . "http://magento-7350-19577-45479.cloudwaysapps.com/skin/frontend/default/sareez/images_001/horizontal-line.png" . '"' . ">\n\t\t\t\t\t</span>";
                     }
                     if ($count == 4) {
                         //echo "44";
                         $testhtml = "<span class=" . '"' . "mark_round" . '"' . ">\n\t\t\t\t\t<a onclick=" . '"' . "document.getElementById('light_popup3').style.display='block';document.getElementById('fade').style.display='block'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . ">?</a></span>\n\t\t\t\t\t<div class=" . '"' . "product_content_popup" . '"' . " id=" . '"' . "light_popup3" . '"' . "><a onclick=" . '"' . "document.getElementById('light_popup3').style.display='none';document.getElementById('fade').style.display='none'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . " class=" . '"' . "close_button_option" . '"' . ">\n\t\t\t\t\t\n\t\t\t\t\t<img src=" . '"' . "http://www.sareez.com/skin/frontend/default/sareez/images/dialog_close.png" . '"' . "></a>\n\t\t\t\t\t<p class=" . '"' . "abcdef" . '"' . ">\n\t\t\t\t\tLehenga style saree comes pre-</br>\n\t\t\t\t\tstitched in their pleats part. </br>\n\t\t\t\t\tPleats are folding done in the</br>\n\t\t\t\t\tsaree to gather it and making </br>\n\t\t\t\t\tit narrow on the front according</br>\n\t\t\t\t\tto the measurements of your </br>\n\t\t\t\t\twaist.</p>   \n\t\t\t\t\t\n\t\t\t\t\t</div> \n\t\t\t\t\t<div class=" . '"' . "black_overlay_popup" . '"' . " id=" . '"' . "fade" . '"' . "></div>\t\n\t\t\t\t\t\n\t\t\t\t\t<span class=" . '"' . "hr_lined" . '"' . "><img src=" . '"' . "http://magento-7350-19577-45479.cloudwaysapps.com/skin/frontend/default/sareez/images_001/horizontal-line.png" . '"' . ">\n\t\t\t\t\t</span>";
                     }
                 } elseif ($firstCategoryId == 27) {
                     //echo $count;
                     $testhtml = "<span class=" . '"' . "mark_round" . '"' . ">\n\t\t<a onclick=" . '"' . "document.getElementById('light_popup').style.display='block';document.getElementById('fade').style.display='block'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . ">?</a></span>\n\t<div class=" . '"' . "product_content_popup" . '"' . " id=" . '"' . "light_popup" . '"' . "><a onclick=" . '"' . "document.getElementById('light_popup').style.display='none';document.getElementById('fade').style.display='none'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . " class=" . '"' . "close_button_option" . '"' . ">\n\t\n\t<img src=" . '"' . "http://www.sareez.com/skin/frontend/default/sareez/images/dialog_close.png" . '"' . "></a>\n\t\t      <p class=" . '"' . "abcdef" . '"' . ">\n\t\t\t  Unstitched salwar kameez when stitched</br>\n\t\t\t  with your perfect measurements by the</br>\n\t\t\t  experts, will give you a perfect look.</br>\n\t\t\t  To give you this perfect look, </br>\n\t\t\t  measurement form is made to fill up </br>\n\t\t\t  and the stitching cost is taken for</br>\n\t\t\t  the labour.</p>   \n        \n         </div> \n\t\t<div class=" . '"' . "black_overlay_popup" . '"' . " id=" . '"' . "fade" . '"' . "></div>\t\n\t\n\t";
                 } elseif ($firstCategoryId == 3) {
                     //echo $count;
                     $testhtml = "<span class=" . '"' . "mark_round" . '"' . ">\n\t\t<a onclick=" . '"' . "document.getElementById('light_popup').style.display='block';document.getElementById('fade').style.display='block'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . ">?</a></span>\n\t<div class=" . '"' . "product_content_popup" . '"' . " id=" . '"' . "light_popup" . '"' . "><a onclick=" . '"' . "document.getElementById('light_popup').style.display='none';document.getElementById('fade').style.display='none'" . '"' . " href=" . '"' . "javascript:void(0)" . '"' . " class=" . '"' . "close_button_option" . '"' . ">\n\t\n\t<img src=" . '"' . "http://www.sareez.com/skin/frontend/default/sareez/images/dialog_close.png" . '"' . "></a>\n\t\t      <p class=" . '"' . "abcdef" . '"' . ">\n\t\t\t  The lehengas are unstitched and they</br>\n\t\t\t  are stitched according to your </br>\n\t\t\t  measurements filled in the measurement</br>\n\t\t\t  form. With the correct measurements </br>\n\t\t\t  and our expert tailoring you get the </br>\n\t\t\t  perfect flaunting look of your </br>\n\t\t\t  selected lehenga choli</br>\n</p>   \n        \n         </div> \n\t\t<div class=" . '"' . "black_overlay_popup" . '"' . " id=" . '"' . "fade" . '"' . "></div>\t\n\t\n\t";
                 }
             }
             ?>
     
     
               <?php 
             if ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
                 if ($buyRequest) {
                     $optionValueQty = $buyRequest->getData('options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty');
                 } else {
                     $optionValueQty = 0;
                 }
                 if (!$optionValueQty && $checked) {
                     $optionValueQty = 1;
                 }
                 $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="optionSetQtyProduct.checkboxQty(this); ' . $onclick . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . $imagesHtml . '<span class="label">
                         <label  ' . $style . ' for="options_' . $_option->getId() . '_' . $count . '">' . $_value->getTitle() . ' ' . $priceStr . $qty . '</label>
                         &nbsp;&nbsp;&nbsp;
                         <label class="label-qty"><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input type="text" class="input-text qty' . ($checked ? ' validate-greater-than-zero' : '') . '" value="' . $optionValueQty . '" maxlength="12" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" onchange="' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();' . $setProdutQtyFunc) . '" onKeyPress="if(event.keyCode==13){' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . '}" ' . ($checked ? $disabled : 'disabled') . '></label>
                      </span>';
             } else {
                 $_product1 = $this->getProduct();
                 $categoryIds1 = $_product1->getCategoryIds();
                 if (count($categoryIds1)) {
                     $firstCategoryId1 = $categoryIds1[0];
                     if ($firstCategoryId1 == 27) {
                         $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="' . $onclick . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . $imagesHtml . '<span class="label option2_price"><label ' . $style . ' for="options_' . $_option->getId() . '_' . $count . '">' . "Salwars Stitching" . ' ' . $testhtml . $priceStr . $qty . '</label></span>';
                     } else {
                         if ($firstCategoryId1 == 3) {
                             $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="' . $onclick . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . $imagesHtml . '<span class="label option2_price"><label ' . $style . ' for="options_' . $_option->getId() . '_' . $count . '">' . "Lehenga Stitching" . ' ' . $testhtml . $priceStr . $qty . '</label></span>';
                         } else {
                             $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="' . $onclick . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . $imagesHtml . '<span class="label"><label ' . $style . ' for="options_' . $_option->getId() . '_' . $count . '">' . $_value->getTitle() . ' ' . $testhtml . $priceStr . $qty . '</label></span>';
                         }
                     }
                 }
             }
             if ($_option->getIsRequire(true)) {
                 $selectHtml .= '<script type="text/javascript">' . '$(\'options_' . $_option->getId() . '_' . $count . '\').advaiceContainer = \'options-' . $_option->getId() . '-container\';' . '$(\'options_' . $_option->getId() . '_' . $count . '\').callbackFunction = \'validateOptionsCallback\';' . '</script>';
             }
             $selectHtml .= '</li>';
         }
         if ($selectHtml) {
             $selectHtml = '<ul id="options-' . $_option->getId() . '-list" class="options-list">' . $selectHtml . '</ul>';
         }
         self::$isFirstOption = false;
         if ($setProdutQtyJs) {
             $selectHtml .= '<script type="text/javascript">' . $setProdutQtyJs . ' optionSetQtyProduct.hideQty();</script>';
             $_option->setOptionSetQtyProduct(1);
         }
         return $selectHtml;
     }
 }
 public function getValuesHtml()
 {
     $_option = $this->getOption();
     $helper = Mage::helper('customoptions');
     $displayQty = $helper->canDisplayQtyForOptions();
     $hideOutOfStockOptions = $helper->canHideOutOfStockOptions();
     $enabledInventory = $helper->isInventoryEnabled();
     $enabledDependent = $helper->isDependentEnabled();
     if (version_compare(Mage::getVersion(), '1.5.0', '>=') && version_compare(Mage::getVersion(), '1.9.0', '<') || version_compare(Mage::getVersion(), '1.10.0', '>=')) {
         $configValue = $this->getProduct()->getPreconfiguredValues()->getData('options/' . $_option->getId());
     } else {
         $configValue = false;
     }
     $buyRequest = false;
     if ($helper->isQntyInputEnabled() && Mage::app()->getRequest()->getControllerName() != 'product') {
         $quoteItemId = (int) $this->getRequest()->getParam('id');
         if ($quoteItemId) {
             $item = Mage::getSingleton('checkout/cart')->getQuote()->getItemById($quoteItemId);
             if ($item) {
                 $buyRequest = $item->getBuyRequest();
                 if ($_option->getType() != Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
                     $optionQty = $buyRequest->getData('options_' . $_option->getId() . '_qty');
                     $_option->setOptionQty($optionQty);
                 }
             }
         }
     }
     if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE) {
         $require = '';
         if ($_option->getIsRequire()) {
             if ($_option->getIsDependent()) {
                 $require = ' required-dependent';
             } else {
                 $require = ' required-entry';
             }
         }
         $extraParams = $enabledDependent && $_option->getIsDependent() ? ' disabled="disabled"' : '';
         $select = $this->getLayout()->createBlock('core/html_select')->setData(array('id' => 'select_' . $_option->getId(), 'class' => $require . ' product-custom-option'));
         if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
             $select->setName('options[' . $_option->getid() . ']')->addOption('', $this->__('-- Please Select --'));
         } else {
             $select->setName('options[' . $_option->getid() . '][]');
             $select->setClass('multiselect' . $require . ' product-custom-option');
         }
         $setProdutQtyJs = '';
         $imagesHtml = '';
         $imagesJs = '';
         $dependentJs = '';
         $defaultFlag = false;
         $itemValueCount = count($_option->getValues());
         if ($enabledDependent && $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE) {
             $dependentJs .= 'dependentDefault["select_' . $_option->getId() . '"] = [];';
         }
         foreach ($_option->getValues() as $_value) {
             $qty = '';
             if ($enabledInventory && $hideOutOfStockOptions && $_value->getCustomoptionsQty() === '0') {
                 continue;
             }
             $selectOptions = array();
             if ($enabledInventory && $_value->getCustomoptionsQty() === '0') {
                 $selectOptions['disabled'] = 'disabled';
             }
             if ($_value->getDefault() == 1 && !isset($selectOptions['disabled']) && !$configValue) {
                 if (!$enabledDependent || !$_option->getIsDependent()) {
                     $selectOptions['selected'] = 'selected';
                 }
                 if ($enabledDependent) {
                     if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
                         $dependentJs .= 'dependentDefault["select_' . $_option->getId() . '"] = ' . $_value->getOptionTypeId() . ';';
                     } else {
                         $dependentJs .= 'dependentDefault["select_' . $_option->getId() . '"][' . $_value->getOptionTypeId() . '] = 1;';
                     }
                 }
                 $defaultFlag = true;
             }
             if ($enabledInventory) {
                 if ($displayQty && substr($_value->getCustomoptionsQty(), 0, 1) != 'x' && $_value->getCustomoptionsQty() !== '') {
                     $qty = ' (' . ($_value->getCustomoptionsQty() > 0 ? $_value->getCustomoptionsQty() : 'Out of stock') . ')';
                 }
                 if (substr($_value->getCustomoptionsQty(), 0, 1) == 'x') {
                     if (!$setProdutQtyJs) {
                         $setProdutQtyJs = 'optionsSetQtyProductData[' . $_option->getId() . '] = [];';
                     }
                     $setProdutQtyJs .= 'optionsSetQtyProductData[' . $_option->getId() . '][' . $_value->getOptionTypeId() . ']=' . intval(substr($_value->getCustomoptionsQty(), 1)) . ';';
                 }
             }
             // if more than 50 IMGs
             if ($itemValueCount > 50 && $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
                 if (!$imagesHtml) {
                     $imagesHtml = $helper->getImgHtml($_value->getImagePath(), $_option->getId(), $_value->getOptionTypeId(), true);
                     $imagesJs = 'optionsImagesData[' . $_option->getId() . '] = [];';
                 }
                 $arr = $helper->getImgHtml($_value->getImagePath(), $_option->getId(), $_value->getOptionTypeId(), true, true);
                 if (isset($arr['big_img_url'])) {
                     $imagesJs .= 'optionsImagesData[' . $_option->getId() . '][' . $_value->getOptionTypeId() . ']=["' . $arr['url'] . '", "' . $arr['big_img_url'] . '"];';
                 }
             } else {
                 $imagesHtml .= $helper->getImgHtml($_value->getImagePath(), $_option->getId(), $_value->getOptionTypeId());
             }
             $priceStr = $helper->getFormatedOptionPrice($this->_formatPrice(array('is_percent' => $_value->getPriceType() == 'percent' ? true : false, 'pricing_value' => $_value->getPrice(true)), false));
             if ($enabledDependent) {
                 if ($_value->getDependentIds()) {
                     $dependentJs .= 'dependentData[' . $_value->getOptionTypeId() . '] = [' . $_value->getDependentIds() . ']; ';
                 }
                 if ($_value->getInGroupId()) {
                     $dependentJs .= 'inGroupIdData[' . $_value->getInGroupId() . '] = {"disabled":' . ($_option->getIsDependent() ? 'true' : 'false') . ', "select_' . $_option->getId() . '":' . $_value->getOptionTypeId() . '}; ';
                 }
             }
             $select->addOption($_value->getOptionTypeId(), $_value->getTitle() . ' ' . $priceStr . $qty, $selectOptions);
         }
         if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE) {
             $extraParams .= ' multiple="multiple"';
         }
         if ($setProdutQtyJs) {
             $setProdutQtyFunc = 'optionsSetQtyProduct.setQty(' . $_option->getId() . ');';
         } else {
             $setProdutQtyFunc = '';
         }
         $showImgFunc = '';
         if ($imagesHtml) {
             if ($imagesJs) {
                 $showImgFunc = 'optionsImages.setImage(' . $_option->getId() . ');';
             } else {
                 $showImgFunc = 'optionsImages.showImage(' . $_option->getId() . ');';
             }
         }
         $select->setExtraParams('onchange="' . ($enabledDependent ? 'dependentOptions.select(this);' : '') . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . $showImgFunc . '"' . $extraParams);
         if ($configValue) {
             $select->setValue($configValue);
             if ($enabledDependent) {
                 $dependentJs .= 'dependentDefault["select_' . $_option->getId() . '"] = ' . $configValue . ';';
             }
         }
         if (count($select->getOptions()) > 1 && $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || count($select->getOptions()) > 0 && $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE) {
             $outHTML = $select->getHtml();
             if ($imagesHtml) {
                 $imagesHtml .= '<script type="text/javascript">' . $imagesJs . '</script>';
                 if ($helper->isImagesAboveOptions()) {
                     $outHTML = $imagesHtml . $outHTML;
                 } else {
                     $outHTML .= $imagesHtml;
                 }
             }
             if ($defaultFlag) {
                 $outHTML .= '<script type="text/javascript">' . $showImgFunc . '</script>';
             }
             if ($dependentJs) {
                 $outHTML .= '<script type="text/javascript">' . $dependentJs . '</script>';
             }
             if ($setProdutQtyJs) {
                 $outHTML .= '<script type="text/javascript">' . $setProdutQtyJs . 'optionsSetQtyProduct.hideQty();</script>';
                 $_option->setOptionsSetQtyProduct(1);
             }
             return $outHTML;
         }
     } elseif ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
         $selectHtml = '';
         $dependentJs = '';
         $setProdutQtyJs = '';
         $require = '';
         if ($_option->getIsRequire()) {
             if ($_option->getIsDependent()) {
                 $require = ' required-dependent';
             } else {
                 $require = ' validate-one-required-by-name';
             }
         }
         $arraySign = '';
         switch ($_option->getType()) {
             case Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO:
                 $type = 'radio';
                 $class = 'radio';
                 break;
             case Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX:
                 $type = 'checkbox';
                 $class = 'checkbox';
                 $arraySign = '[]';
                 break;
         }
         $count = 1;
         foreach ($_option->getValues() as $_value) {
             $count++;
             $priceStr = $helper->getFormatedOptionPrice($this->_formatPrice(array('is_percent' => $_value->getPriceType() == 'percent' ? true : false, 'pricing_value' => $_value->getPrice(true))));
             $qty = '';
             if ($enabledInventory && $hideOutOfStockOptions && $_value->getCustomoptionsQty() === '0') {
                 continue;
             }
             $inventory = $enabledInventory && $_value->getCustomoptionsQty() === '0' ? false : true;
             $disabled = !$inventory || $enabledDependent && $_option->getIsDependent() ? 'disabled="disabled"' : '';
             if ($enabledInventory) {
                 if ($displayQty && substr($_value->getCustomoptionsQty(), 0, 1) != 'x' && $_value->getCustomoptionsQty() !== '') {
                     $qty = ' (' . ($_value->getCustomoptionsQty() > 0 ? $_value->getCustomoptionsQty() : 'Out of stock') . ')';
                 }
                 if (substr($_value->getCustomoptionsQty(), 0, 1) == 'x') {
                     if (!$setProdutQtyJs) {
                         $setProdutQtyJs = 'optionsSetQtyProductData[' . $_option->getId() . '] = [];';
                     }
                     $setProdutQtyJs .= 'optionsSetQtyProductData[' . $_option->getId() . '][' . $_value->getOptionTypeId() . ']=' . intval(substr($_value->getCustomoptionsQty(), 1)) . ';';
                 }
             }
             if ($disabled && $enabledDependent && $helper->hideDependentOption() && $_option->getIsDependent()) {
                 $selectHtml .= '<li style="display: none;">';
             } else {
                 $selectHtml .= '<li>';
             }
             $selectHtml .= $helper->getImgHtml($_value->getImagePath(), $_option->getId());
             if ($configValue) {
                 $htmlValue = $_value->getOptionTypeId();
                 if ($arraySign) {
                     $checked = is_array($configValue) && in_array($htmlValue, $configValue) ? 'checked' : '';
                 } else {
                     $checked = $configValue == $htmlValue ? 'checked' : '';
                 }
             } else {
                 $checked = $_value->getDefault() == 1 && !$disabled ? 'checked' : '';
             }
             if ($enabledDependent) {
                 if ($_value->getDependentIds()) {
                     $dependentJs .= 'dependentData[' . $_value->getOptionTypeId() . '] = [' . $_value->getDependentIds() . ']; ';
                 }
                 if ($_value->getInGroupId()) {
                     $dependentJs .= 'inGroupIdData[' . $_value->getInGroupId() . '] = {"disabled":' . ($_option->getIsDependent() ? 'true' : 'false') . ', "out_of_stock":' . ($enabledInventory && $_value->getCustomoptionsQty() === '0' ? 'true' : 'false') . ', "options_' . $_option->getId() . '_' . $count . '":1}; ';
                 }
                 if ($checked || $_value->getDefault() == 1 && $inventory) {
                     $dependentJs .= 'dependentDefault["options_' . $_option->getId() . '_' . $count . '"] = 1;';
                 }
             }
             if ($setProdutQtyJs) {
                 $setProdutQtyFunc = 'optionsSetQtyProduct.setQty(' . $_option->getId() . ');';
             } else {
                 $setProdutQtyFunc = '';
             }
             if ($checked) {
                 $setProdutQtyJs .= $setProdutQtyFunc;
             }
             if ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
                 if ($buyRequest) {
                     $optionValueQty = $buyRequest->getData('options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty');
                 } else {
                     $optionValueQty = 0;
                 }
                 if (!$optionValueQty) {
                     $optionValueQty = 1;
                 }
                 $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="$(\'options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty\').disabled=!this.checked; if ($(\'options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty\').value<=0) $(\'options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty\').value=1; ' . ($enabledDependent ? 'dependentOptions.select(this);' : '') . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . '<span class="label">
                         <label for="options_' . $_option->getId() . '_' . $count . '">' . $_value->getTitle() . ' ' . $priceStr . $qty . '</label>
                         &nbsp;&nbsp;&nbsp;
                         <label><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input type="text" class="input-text qty validate-greater-than-zero" value="' . $optionValueQty . '" maxlength="12" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" onchange="' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . '" onKeyPress="if(event.keyCode==13){' . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . '}" ' . ($checked ? $disabled : 'disabled') . '></label>
                      </span>';
             } elseif ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
                 $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="' . ($enabledDependent ? 'dependentOptions.select(this);' : '') . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . '<span class="label"><label for="options_' . $_option->getId() . '_' . $count . '">' . $_option->getTitle() . ' ' . $priceStr . $qty . '</label></span>';
             } else {
                 $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="' . ($enabledDependent ? 'dependentOptions.select(this);' : '') . (Mage::app()->getStore()->isAdmin() ? '' : 'opConfig.reloadPrice();') . $setProdutQtyFunc . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . '<span class="label"><label for="options_' . $_option->getId() . '_' . $count . '">' . $_value->getTitle() . ' ' . $priceStr . $qty . '</label></span>';
             }
             if ($_option->getIsRequire()) {
                 $selectHtml .= '<script type="text/javascript">' . '$(\'options_' . $_option->getId() . '_' . $count . '\').advaiceContainer = \'options-' . $_option->getId() . '-container\';' . '$(\'options_' . $_option->getId() . '_' . $count . '\').callbackFunction = \'validateOptionsCallback\';' . '</script>';
             }
             $selectHtml .= '</li>';
         }
         if ($selectHtml) {
             $selectHtml = '<ul id="options-' . $_option->getId() . '-list" class="options-list">' . $selectHtml . '</ul>';
         }
         self::$isFirstOption = false;
         if ($dependentJs) {
             $selectHtml .= '<script type="text/javascript">' . $dependentJs . '</script>';
         }
         if ($setProdutQtyJs) {
             $selectHtml .= '<script type="text/javascript">' . $setProdutQtyJs . 'optionsSetQtyProduct.hideQty();</script>';
             $_option->setOptionsSetQtyProduct(1);
         }
         return $selectHtml;
     }
 }
Example #4
0
 public function getValuesHtml()
 {
     $_option = $this->getOption();
     $helper = Mage::helper('mageworx_customoptions');
     $displayQty = $helper->canDisplayQtyForOptions();
     $outOfStockOptions = $helper->getOutOfStockOptions();
     $enabledInventory = $helper->isInventoryEnabled();
     $enabledDependent = $helper->isDependentEnabled();
     $enabledSpecialPrice = $helper->isSpecialPriceEnabled();
     $hideDependentOption = $helper->hideDependentOption();
     $displayLowStockMessage = $helper->canDisplayLowStockMessage();
     $lowStockValue = $helper->getLowStockValue();
     $configValue = $helper->getPreconfiguredValues($this->getProduct(), $_option->getId());
     $buyRequest = false;
     $quoteItemId = 0;
     if ($helper->isQntyInputEnabled() && Mage::app()->getRequest()->getControllerName() != 'product') {
         $quoteItemId = (int) $this->getRequest()->getParam('id');
         if ($quoteItemId) {
             if (Mage::app()->getStore()->isAdmin()) {
                 $item = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getItemById($quoteItemId);
             } else {
                 $item = Mage::getSingleton('checkout/cart')->getQuote()->getItemById($quoteItemId);
             }
             if ($item) {
                 $buyRequest = $item->getBuyRequest();
                 if ($_option->getType() != Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
                     $optionQty = $buyRequest->getData('options_' . $_option->getId() . '_qty');
                     $_option->setOptionQty($optionQty);
                 }
             }
         }
     }
     $optionJs = '';
     if (!Mage::app()->getStore()->isAdmin()) {
         $optionJs .= 'opConfig.reloadPrice();';
     }
     if ($_option->getIsXQtyEnabled()) {
         $optionJs .= ' optionSetQtyProduct.setQty();';
     }
     if ($_option->getIsDependentLQty()) {
         $optionJs .= ' optionSetQtyProduct.checkLimitQty(' . $_option->getId() . ', this);';
     }
     if ($_option->getIsParentLQty()) {
         $optionJs .= ' optionSetQtyProduct.setLimitQty(this);';
     }
     $qtyInputType = $helper->isProductQtyDecimal($this->getProduct()) ? 'type="number" pattern="[0-9]+([\\,|\\.][0-9]+)?" step="0.01"' : 'type="number" pattern="[0-9]+([\\,|\\.][0-9]+)?"';
     if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
         $require = '';
         if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $require = ' hidden';
         }
         if ($_option->getIsRequire(true)) {
             if ($enabledDependent && $_option->getIsDependent()) {
                 $require .= ' required-dependent';
             } else {
                 $require .= ' required-entry';
             }
         }
         $extraParams = $enabledDependent && $_option->getIsDependent() ? ' disabled="disabled"' : '';
         $select = $this->getLayout()->createBlock('core/html_select')->setData(array('id' => 'select_' . $_option->getId(), 'class' => $require . ' product-custom-option' . ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH ? ' swatch' : '')));
         if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH) {
             $select->setName('options[' . $_option->getid() . ']')->addOption('', $this->__('-- Please Select --'));
         } else {
             $select->setName('options[' . $_option->getid() . '][]');
             $select->setClass('multiselect' . $require . ' product-custom-option');
         }
         $imagesHtml = '';
         $showImgFlag = false;
         foreach ($_option->getValues() as $_value) {
             $qty = '';
             $customoptionsQty = $helper->getCustomoptionsQty($_value->getCustomoptionsQty(), $_value->getSku(), $this->getProduct()->getId(), $_value->getExtra(), $_value, $quoteItemId);
             if ($enabledInventory && $outOfStockOptions == 1 && (is_numeric($customoptionsQty) && $customoptionsQty == 0 || $_value->getIsOutOfStock())) {
                 continue;
             }
             $selectOptions = array();
             $disabled = '';
             if ($enabledInventory && $customoptionsQty <= 0 && $customoptionsQty !== '' && ($outOfStockOptions == 0 || $outOfStockOptions == 4)) {
                 $selectOptions['disabled'] = $disabled = 'disabled';
             }
             $selected = '';
             if ($_value->getDefault() == 1 && !$disabled && !$configValue) {
                 if (!$enabledDependent || !$_option->getIsDependent()) {
                     $selectOptions['selected'] = $selected = 'selected';
                 }
             } elseif ($configValue) {
                 $selected = is_array($configValue) && in_array($_value->getOptionTypeId(), $configValue) ? 'selected' : '';
             }
             if ($enabledInventory) {
                 if ($displayQty == 1 && $customoptionsQty > 0 && $customoptionsQty >= $lowStockValue) {
                     $qty = ' (' . $customoptionsQty . ')';
                 }
                 if ($displayQty == 2 && $customoptionsQty > 0) {
                     $qty = ' (' . $customoptionsQty . ')';
                 }
                 if ($displayQty == 3 && $customoptionsQty > 0 && $customoptionsQty < $lowStockValue) {
                     $qty = ' (' . $customoptionsQty . ')';
                 }
                 if ($customoptionsQty <= 0 && $outOfStockOptions == 4 && $customoptionsQty !== NULL && $customoptionsQty !== '') {
                     $qty .= ' (' . $helper->__('Out of stock') . ')';
                 }
                 if ($displayLowStockMessage && $lowStockValue > 0 && $customoptionsQty > 0 && $customoptionsQty <= $lowStockValue) {
                     $qty .= ' (' . $helper->__('Low stock') . ')';
                 }
             }
             $priceStr = $_option->getFormattedOptionPrice($_value);
             // swatch
             if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
                 $images = $_value->getImages();
                 if (count($images) > 0) {
                     $showImgFlag = true;
                     if ($disabled) {
                         $onClick = 'return false;';
                         $className = 'swatch swatch-disabled';
                     } else {
                         $onClick = 'optionSwatch.select(' . $_option->getId() . ', ' . $_value->getOptionTypeId() . ');';
                         if ($_option->getIsDependentLQty()) {
                             $onClick .= ' optionSetQtyProduct.checkLimitQty(' . $_option->getId() . ', ' . $_value->getOptionTypeId() . ');';
                         }
                         $onClick .= ' return false;';
                         $className = 'swatch';
                         if (!$hideDependentOption && $_option->getIsDependent()) {
                             $className .= ' swatch-disabled';
                         }
                     }
                     if ($buyRequest) {
                         $optionValueQty = $buyRequest->getData('options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty');
                     } else {
                         $optionValueQty = 0;
                     }
                     $image = $images[0];
                     if ($image['source'] == 1) {
                         // file
                         $arr = $helper->getImgData($image['image_file']);
                         if (isset($arr['big_img_url'])) {
                             $title = $this->htmlEscape($_value->getTitle() . ($priceStr ? ' - ' . strip_tags(str_replace(array('<s>', '</s>'), array('(', ')'), $priceStr)) : ''));
                             $imagesHtml .= '<li id="swatch_' . $_value->getOptionTypeId() . '" class="' . $className . '">' . '<a href="' . $arr['big_img_url'] . '" onclick="' . $onClick . '">' . '<img src="' . $arr['url'] . '" title="' . $title . '" alt="' . $title . '" class="swatch small-image-preview v-middle" />' . '</a>';
                             $imagesHtml .= $_option->showSwatchTitle($_value);
                             $imagesHtml .= ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH ? '<div><label><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input ' . $qtyInputType . ' class="qty' . ($selected ? ' validate-greater-than-zero' : '') . '" value="' . $optionValueQty . '" maxlength="12" min="0" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" onchange="' . $optionJs . '" onKeyPress="if(event.keyCode==13){' . $optionJs . '}" ' . ($selected ? $disabled : 'disabled') . '></label></div>' : '') . '</li>';
                         }
                     } elseif ($image['source'] == 2) {
                         // color
                         $imagesHtml .= '<li id="swatch_' . $_value->getOptionTypeId() . '" class="' . $className . '">' . '<a href="#" onclick="' . $onClick . '">' . '<div class="swatch container-swatch-color small-image-preview v-middle" title="' . $this->htmlEscape($_value->getTitle() . ($priceStr ? ' - ' . strip_tags(str_replace(array('<s>', '</s>'), array('(', ')'), $priceStr)) : '')) . '">' . '<div class="swatch-color" style="background:' . $image['image_file'] . ';">&nbsp;</div>' . '</div>' . '</a>';
                         $imagesHtml .= $_option->showSwatchTitle($_value);
                         $imagesHtml .= ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH ? '<div><label><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input ' . $qtyInputType . ' class="qty' . ($selected ? ' validate-greater-than-zero' : '') . '" value="' . $optionValueQty . '" maxlength="12" min="0" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" onchange="' . $optionJs . '" onKeyPress="if(event.keyCode==13){' . $optionJs . '}" ' . ($selected ? $disabled : 'disabled') . '></label></div>' : '') . '</li>';
                     }
                 }
             } else {
                 if (!$imagesHtml && $_value->getImages()) {
                     $showImgFlag = true;
                     if ($_option->getImageMode() == 1 || $_option->getImageMode() > 1 && $_option->getExcludeFirstImage()) {
                         $imagesHtml = '<div id="customoptions_images_' . $_option->getId() . '" class="customoptions-images-div" style="display:none"></div>';
                     }
                 }
             }
             $select->addOption($_value->getOptionTypeId(), $_value->getTitle() . ' ' . $priceStr . $qty, $selectOptions);
         }
         if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $extraParams .= ' multiple="multiple"';
         }
         if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $style = 'height: 1px; min-height: 1px; clear: both;';
             if (Mage::app()->getStore()->isAdmin()) {
                 $style .= ' visibility: hidden;';
             }
             $extraParams .= ' style="' . $style . '"';
         }
         if ($showImgFlag) {
             $showImgFunc = 'optionImages.showImage(this);';
         } else {
             $showImgFunc = '';
         }
         if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
             $showImgFunc .= ' optionSwatch.change(this);';
         }
         $select->setExtraParams('onchange="' . ($enabledDependent ? 'dependentOptions.select(this); ' : '') . $showImgFunc . $optionJs . '"' . $extraParams);
         if ($configValue) {
             $select->setValue($configValue);
         }
         if (count($select->getOptions()) > 1 && ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH) || count($select->getOptions()) > 0 && ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH)) {
             $outHTML = $select->getHtml();
             if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
                 $outHTML .= '<div class="tagtip-question" id="select_description_' . $_option->getId() . '" style="display:none;"></div>';
             }
             if ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_SWATCH || $_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_MULTISWATCH) {
                 $outHTML = '<ul id="ul_swatch_' . $_option->getId() . '">' . $imagesHtml . '</ul>' . $outHTML;
             } else {
                 if ($imagesHtml) {
                     if ($helper->isImagesAboveOptions()) {
                         $outHTML = $imagesHtml . $outHTML;
                     } else {
                         $outHTML .= $imagesHtml;
                     }
                 }
             }
             return $outHTML;
         }
     } elseif ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
         $selectHtml = '';
         $require = '';
         if ($_option->getIsRequire(true)) {
             if ($enabledDependent && $_option->getIsDependent()) {
                 $require = ' required-dependent';
             } else {
                 $require = ' validate-one-required-by-name';
             }
         } else {
             if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO && !$_option->getIsRequire()) {
                 $selectHtml .= '<li><input type="radio" id="options_' . $_option->getId() . '" class="' . $class . ' radio product-custom-option" name="options[' . $_option->getId() . ']"' . ($this->getSkipJsReloadPrice() ? '' : ' onclick="opConfig.reloadPrice()"') . ' value="" checked="checked" /><span class="label"><label for="options_' . $_option->getId() . '">' . $this->__('None') . '</label></span></li>';
             }
         }
         $arraySign = '';
         switch ($_option->getType()) {
             case Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO:
                 $type = 'radio';
                 $class = 'radio';
                 break;
             case Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX:
                 $type = 'checkbox';
                 $class = 'checkbox';
                 $arraySign = '[]';
                 break;
         }
         $count = 0;
         foreach ($_option->getValues() as $_value) {
             $count++;
             if ($_value->getPriceType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::PRICE_TYPE_OPTIONS_PERCENT) {
                 $priceStr = '<span class="price-notice">' . '+' . '<span class="price">' . (int) $_value->getPrice() . '%' . '</span>' . '</span>';
             } else {
                 $priceStr = $helper->getFormatedOptionPrice($this->getProduct(), $_option, $_value);
             }
             $qty = '';
             $customoptionsQty = $helper->getCustomoptionsQty($_value->getCustomoptionsQty(), $_value->getSku(), $this->getProduct()->getId(), $_value->getExtra(), $_value, $quoteItemId, null, false, true);
             if ($enabledInventory && $outOfStockOptions == 1 && ($customoptionsQty === 0 || $_value->getIsOutOfStock())) {
                 continue;
             }
             $inventory = $enabledInventory && $customoptionsQty <= 0 && $customoptionsQty !== '' ? false : true;
             $disabled = !$inventory && ($outOfStockOptions == 0 || $outOfStockOptions == 4) || $enabledDependent && $_option->getIsDependent() ? 'disabled="disabled"' : '';
             if ($enabledInventory) {
                 if ($displayQty == 1 && $customoptionsQty > 0 && $customoptionsQty >= $lowStockValue) {
                     $qty = ' (' . $customoptionsQty . ')';
                 }
                 if ($displayQty == 2 && $customoptionsQty > 0) {
                     $qty = ' (' . $customoptionsQty . ')';
                 }
                 if ($displayQty == 3 && $customoptionsQty > 0 && $customoptionsQty < $lowStockValue) {
                     $qty = ' (' . $customoptionsQty . ')';
                 }
                 if ($customoptionsQty <= 0 && $outOfStockOptions == 4 && $customoptionsQty !== NULL && $customoptionsQty !== '') {
                     $qty .= ' (' . $helper->__('Out of stock') . ')';
                 }
                 if ($displayLowStockMessage && $lowStockValue > 0 && $customoptionsQty > 0 && $customoptionsQty <= $lowStockValue) {
                     $qty .= ' (' . $helper->__('Low stock') . ')';
                 }
             }
             if ($disabled && $enabledDependent && $helper->hideDependentOption() && $_option->getIsDependent()) {
                 $selectHtml .= '<li style="display: none;">';
             } else {
                 $selectHtml .= '<li>';
             }
             $imagesHtml = '';
             $images = $_value->getImages();
             if ($images) {
                 if ($_option->getImageMode() == 1) {
                     foreach ($images as $image) {
                         $imgData = $helper->getImgData($image['image_file']);
                         if ($imgData) {
                             $imgData['class'] = 'radio-checkbox-img';
                             $imagesHtml .= $helper->getImgHtml($imgData);
                         }
                     }
                 } elseif ($_option->getExcludeFirstImage()) {
                     $image = $images[0];
                     $imgData = $helper->getImgData($image['image_file']);
                     if ($imgData) {
                         $imgData['class'] = 'radio-checkbox-img';
                         $imagesHtml .= $helper->getImgHtml($imgData);
                     }
                 }
             }
             if ($configValue) {
                 if ($arraySign) {
                     $checked = is_array($configValue) && in_array($_value->getOptionTypeId(), $configValue) ? 'checked' : '';
                 } else {
                     $checked = $configValue == $_value->getOptionTypeId() ? 'checked' : '';
                 }
             } else {
                 $checked = $_value->getDefault() == 1 && !$disabled ? 'checked' : '';
             }
             if ($images && $_option->getImageMode() > 1) {
                 $showImgFunc = 'optionImages.showImage(this);';
             } else {
                 $showImgFunc = '';
             }
             $onclick = ($enabledDependent ? 'dependentOptions.select(this);' : '') . $optionJs . $showImgFunc;
             if ($helper->isQntyInputEnabled() && $_option->getQntyInput() && $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX) {
                 if ($buyRequest) {
                     $optionValueQty = $buyRequest->getData('options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty');
                 } else {
                     $optionValueQty = 0;
                 }
                 if (!$optionValueQty && $checked) {
                     $optionValueQty = 1;
                 }
                 //                    Old variant:
                 //                    $selectHtml .=
                 //                        '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="optionSetQtyProduct.checkboxQty(this); '.$onclick.'" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />'
                 //                        . $imagesHtml .
                 //                        '<span class="label">
                 //                            <label for="options_' . $_option->getId() . '_' . $count . '">' . $_value->getTitle() . ' ' . $priceStr . $qty . '</label>
                 //                            &nbsp;&nbsp;&nbsp;
                 //                            <label class="label-qty"><b>'.$helper->getDefaultOptionQtyLabel().'</b> <input type="text" class="qty'. ($checked?' validate-greater-than-zero':'') .'" value="'.$optionValueQty.'" maxlength="12" id="options_'.$_option->getId().'_'.$_value->getOptionTypeId().'_qty" name="options_'.$_option->getId().'_'.$_value->getOptionTypeId().'_qty" onchange="'. $optionJs .'" onKeyPress="if(event.keyCode==13){'. $optionJs .'}" '.($checked?$disabled:'disabled').'></label>
                 //                         </span>';
                 if ($imagesHtml) {
                     $cssVariant = 2;
                 } else {
                     $cssVariant = 1;
                 }
                 $selectHtml .= '<span class="radio-checkbox-label">' . '<label class="radio-checkbox-label-' . $cssVariant . '" onclick="if ($(Event.element(event)).hasClassName(\'qty\')) return false">' . '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick=" ' . $onclick . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . $imagesHtml . '<div class="radio-checkbox-text">' . $_value->getTitle() . ' ' . $priceStr . $qty . '</div>' . '<div class="label-qty"><b>' . $helper->getDefaultOptionQtyLabel() . '</b> <input ' . $qtyInputType . ' class="qty' . ($checked ? ' validate-greater-than-zero' : '') . '" value="' . $optionValueQty . '" maxlength="12" min="0" id="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" name="options_' . $_option->getId() . '_' . $_value->getOptionTypeId() . '_qty" pattern="\\d*" onchange="' . $optionJs . '" onKeyPress="if(event.keyCode==13){' . $optionJs . '}" ' . ($checked ? $disabled : 'disabled') . '></div>' . '</label>';
             } elseif ($imagesHtml) {
                 $selectHtml .= '<span class="radio-checkbox-label">' . '<label class="radio-checkbox-label-1" onclick="if ($(Event.element(event)).hasClassName(\'qty\')) return false">' . '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick=" ' . $onclick . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . $imagesHtml . '<div class="radio-checkbox-text">' . $_value->getTitle() . ' ' . $priceStr . $qty . '</div>' . '</label>';
             } else {
                 $selectHtml .= '<input ' . $disabled . ' ' . $checked . ' type="' . $type . '" class="' . $class . ' ' . $require . ' product-custom-option" onclick="' . $onclick . '" name="options[' . $_option->getId() . ']' . $arraySign . '" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />' . '<span class="label"><label for="options_' . $_option->getId() . '_' . $count . '">' . $_value->getTitle() . ' ' . $priceStr . $qty . '</label>';
             }
             if ($_value->getDescription() && $helper->isOptionVariationDescriptionEnabled()) {
                 $selectHtml .= '<span class="tagtip-question" id="select_description_' . $_option->getId() . '_' . $_value->getId() . '"></span>';
                 $selectHtml .= '<script type="text/javascript">new Tagtip("select_description_' . $_option->getId() . '_' . $_value->getId() . '", "' . $_value->getDescription() . '", {align: "rightMiddle"});</script>';
             }
             $selectHtml .= '</span>';
             if ($_option->getIsRequire(true)) {
                 $selectHtml .= '<script type="text/javascript">' . '$(\'options_' . $_option->getId() . '_' . $count . '\').advaiceContainer = \'options-' . $_option->getId() . '-container\';' . '$(\'options_' . $_option->getId() . '_' . $count . '\').callbackFunction = \'validateOptionsCallback\';' . '</script>';
             }
             $selectHtml .= '</li>';
         }
         if ($selectHtml) {
             $selectHtml = '<ul id="options-' . $_option->getId() . '-list" class="options-list">' . $selectHtml . '</ul>';
         }
         self::$isFirstOption = false;
         return $selectHtml;
     } elseif ($_option->getType() == MageWorx_CustomOptions_Model_Catalog_Product_Option::OPTION_TYPE_HIDDEN) {
         $count = 0;
         $selectHtml = '';
         foreach ($_option->getValues() as $_value) {
             $count++;
             $customoptionsQty = $helper->getCustomoptionsQty($_value->getCustomoptionsQty(), $_value->getSku(), $this->getProduct()->getId(), $_value->getExtra(), $_value, $quoteItemId);
             if ($enabledInventory && $outOfStockOptions == 1 && ($customoptionsQty === 0 || $_value->getIsOutOfStock())) {
                 continue;
             }
             $inventory = $enabledInventory && $customoptionsQty === 0 && $customoptionsQty !== '' ? false : true;
             $disabled = !$inventory && ($outOfStockOptions == 0 || $outOfStockOptions == 4) || $enabledDependent && $_option->getIsDependent() ? 'disabled="disabled"' : '';
             $selectHtml .= '<input ' . $disabled . ' type="hidden" class="product-custom-option" name="options[' . $_option->getId() . '][]" id="options_' . $_option->getId() . '_' . $count . '" value="' . $_value->getOptionTypeId() . '" />';
         }
         return $selectHtml;
     }
 }