Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BundleOptionPrice.php
Go to the documentation of this file.
1 <?php
7 
12 
17 {
21  const PRICE_CODE = 'bundle_option';
22 
26  protected $calculator;
27 
32  protected $selectionFactory;
33 
37  protected $maximalPrice;
38 
42  private $bundleOptions;
43 
52  public function __construct(
53  Product $saleableItem,
54  $quantity,
57  BundleSelectionFactory $bundleSelectionFactory,
58  BundleOptions $bundleOptions = null
59  ) {
60  $this->selectionFactory = $bundleSelectionFactory;
61  parent::__construct($saleableItem, $quantity, $calculator, $priceCurrency);
62  $this->product->setQty($this->quantity);
63  $this->bundleOptions = $bundleOptions ?: ObjectManager::getInstance()->get(BundleOptions::class);
64  }
65 
69  public function getValue()
70  {
71  if (null === $this->value) {
72  $this->value = $this->bundleOptions->calculateOptions($this->product);
73  }
74 
75  return $this->value;
76  }
77 
84  public function getMaxValue()
85  {
86  if (null === $this->maximalPrice) {
87  $this->maximalPrice = $this->bundleOptions->calculateOptions($this->product, false);
88  }
89 
90  return $this->maximalPrice;
91  }
92 
98  public function getOptions()
99  {
100  return $this->bundleOptions->getOptions($this->product);
101  }
102 
109  public function getOptionSelectionAmount($selection)
110  {
111  return $this->bundleOptions->getOptionSelectionAmount(
112  $this->product,
113  $selection,
114  false
115  );
116  }
117 
124  protected function calculateOptions($searchMin = true)
125  {
126  return $this->bundleOptions->calculateOptions($this->product, $searchMin);
127  }
128 
134  public function getAmount()
135  {
136  return $this->calculator->getOptionsAmount($this->product);
137  }
138 }
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
__construct(Product $saleableItem, $quantity, BundleCalculatorInterface $calculator, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, BundleSelectionFactory $bundleSelectionFactory, BundleOptions $bundleOptions=null)