6 declare(strict_types=1);
28 private $selectionFactory;
33 private $optionSelectionAmountCache = [];
43 $this->calculator = $calculator;
44 $this->selectionFactory = $bundleSelectionFactory;
81 public function calculateOptions(
83 bool $searchMin =
true 88 if ($searchMin && !
$option->getRequired()) {
93 $selectionPriceList = $this->calculator->processOptions(
$option, $selectionPriceList, $searchMin);
94 $priceList = array_merge($priceList, $selectionPriceList);
113 bool $useRegularPrice =
false 119 $selection->getOptionId(),
120 $selection->getSelectionId(),
121 $useRegularPrice ? 1 : 0,
125 if (!isset($this->optionSelectionAmountCache[$cacheKey])) {
126 $selectionPrice = $this->selectionFactory
130 $selection->getSelectionQty(),
131 [
'useRegularPrice' => $useRegularPrice]
133 $this->optionSelectionAmountCache[$cacheKey] = $selectionPrice->getAmount();
136 return $this->optionSelectionAmountCache[$cacheKey];
__construct(BundleCalculatorInterface $calculator, BundleSelectionFactory $bundleSelectionFactory)
getOptionSelectionAmount(Product $bundleProduct, $selection, bool $useRegularPrice=false)