Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfiguredRegularPrice.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
14 
19 {
24 
28  private $item;
29 
33  private $configuredOptions;
34 
43  public function __construct(
44  Product $saleableItem,
45  $quantity,
48  ConfiguredOptions $configuredOptions,
49  ItemInterface $item = null
50  ) {
51  $this->item = $item;
52  $this->configuredOptions = $configuredOptions;
53  parent::__construct($saleableItem, $quantity, $calculator, $priceCurrency);
54  }
55 
60  public function setItem(ItemInterface $item) : ConfiguredRegularPrice
61  {
62  $this->item = $item;
63 
64  return $this;
65  }
66 
72  public function getValue()
73  {
74  $basePrice = parent::getValue();
75 
76  return $this->item && $basePrice !== false
77  ? $basePrice + $this->configuredOptions->getItemOptionsValue($basePrice, $this->item)
78  : $basePrice;
79  }
80 }
__construct(Product $saleableItem, $quantity, CalculatorInterface $calculator, PriceCurrencyInterface $priceCurrency, ConfiguredOptions $configuredOptions, ItemInterface $item=null)