Ejemplo n.º 1
0
 /**
  * Calculate maximal or minimal options value
  *
  * @param bool $searchMin
  * @return bool|float
  */
 protected function calculateOptions($searchMin = true)
 {
     $priceList = [];
     /* @var $option \Magento\Bundle\Model\Option */
     foreach ($this->getOptions() as $option) {
         if ($searchMin && !$option->getRequired()) {
             continue;
         }
         $selectionPriceList = $this->calculator->createSelectionPriceList($option, $this->product);
         $selectionPriceList = $this->calculator->processOptions($option, $selectionPriceList, $searchMin);
         $priceList = array_merge($priceList, $selectionPriceList);
     }
     $amount = $this->calculator->calculateBundleAmount(0.0, $this->product, $priceList);
     return $amount->getValue();
 }