示例#1
0
 /**
  * Check whether required option is not missed, add values to configuration
  *
  * @param array $skuParts
  * @param Mage_Catalog_Model_Product_Option $option
  * @return bool
  */
 protected function _processProductOption(array &$skuParts, Mage_Catalog_Model_Product_Option $option)
 {
     $missedRequired = true;
     $optionValues = $option->getValues();
     if (empty($optionValues)) {
         if ($option->hasSku()) {
             $found = array_search($option->getSku(), $skuParts);
             if ($found !== false) {
                 unset($skuParts[$found]);
             }
         }
         // we are not able to configure such option automatically
         return !$missedRequired;
     }
     foreach ($optionValues as $optionValue) {
         $found = array_search($optionValue->getSku(), $skuParts);
         if ($found !== false) {
             $this->_addSuccessOption($option, $optionValue);
             unset($skuParts[$found]);
             // we've found the value of required option
             $missedRequired = false;
             if (!$this->_isOptionMultiple($option)) {
                 break 1;
             }
         }
     }
     return !$missedRequired;
 }