Ejemplo n.º 1
0
 /**
  * Return SKU for selected option
  *
  * @param string $optionValue Prepared for cart option value
  * @param string $skuDelimiter Delimiter for Sku parts
  * @return string
  */
 public function getOptionSku($optionValue, $skuDelimiter)
 {
     $option = $this->getOption();
     if (!$this->_isSingleSelection()) {
         $skus = array();
         foreach (explode(',', $optionValue) as $value) {
             if ($optionSku = $option->getValueById($value)) {
                 $skus[] = $optionSku->getSku();
             } else {
                 if ($this->getListener()) {
                     $this->getListener()->setHasError(true)->setMessage(Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.'));
                     break;
                 }
             }
         }
         $result = implode($skuDelimiter, $skus);
     } elseif ($this->_isSingleSelection()) {
         if ($result = $option->getValueById($optionValue)) {
             return $result->getSku();
         } else {
             if ($this->getListener()) {
                 $this->getListener()->setHasError(true)->setMessage(Mage::helper('catalog')->__('Some of the products below do not have all the required options. Please remove them and add again with all the required options.'));
             }
             return '';
         }
     } else {
         $result = parent::getOptionSku($optionValue, $skuDelimiter);
     }
     return $result;
 }