7
7
namespace Magento \Catalog \Pricing \Render ;
8
8
9
9
use Magento \Catalog \Model \Product \Configuration \Item \ItemInterface ;
10
+ use Magento \Catalog \Model \Product \Pricing \Renderer \SalableResolverInterface ;
11
+ use Magento \Catalog \Pricing \Price \MinimalPriceCalculatorInterface ;
10
12
use Magento \Framework \Pricing \Price \PriceInterface ;
11
13
use Magento \Catalog \Pricing \Price \ConfiguredPriceInterface ;
12
14
use Magento \Catalog \Pricing \Price \FinalPrice ;
13
15
use Magento \Catalog \Pricing \Price \RegularPrice ;
16
+ use Magento \Framework \Pricing \Render \RendererPool ;
17
+ use Magento \Framework \Pricing \SaleableInterface ;
18
+ use Magento \Framework \View \Element \Template \Context ;
14
19
15
20
/**
16
21
* Class for configured_price rendering
17
22
*/
18
23
class ConfiguredPriceBox extends FinalPriceBox
19
24
{
25
+ /**
26
+ * @var \Magento\Catalog\Pricing\Price\ConfiguredPriceSelection
27
+ */
28
+ private $ configuredPriceSelection ;
29
+
30
+ /**
31
+ * @param Context $context
32
+ * @param SaleableInterface $saleableItem
33
+ * @param PriceInterface $price
34
+ * @param RendererPool $rendererPool
35
+ * @param array $data
36
+ * @param SalableResolverInterface|null $salableResolver
37
+ * @param MinimalPriceCalculatorInterface|null $minimalPriceCalculator
38
+ * @param \Magento\Catalog\Pricing\Price\ConfiguredPriceSelection|null $configuredPriceSelection
39
+ */
40
+ public function __construct (
41
+ Context $ context ,
42
+ SaleableInterface $ saleableItem ,
43
+ PriceInterface $ price ,
44
+ RendererPool $ rendererPool ,
45
+ array $ data = [],
46
+ SalableResolverInterface $ salableResolver = null ,
47
+ MinimalPriceCalculatorInterface $ minimalPriceCalculator = null ,
48
+ \Magento \Catalog \Pricing \Price \ConfiguredPriceSelection $ configuredPriceSelection = null
49
+ ) {
50
+ $ this ->configuredPriceSelection = $ configuredPriceSelection
51
+ ?: \Magento \Framework \App \ObjectManager::getInstance ()
52
+ ->get (\Magento \Catalog \Pricing \Price \ConfiguredPriceSelection::class);
53
+ parent ::__construct (
54
+ $ context ,
55
+ $ saleableItem ,
56
+ $ price ,
57
+ $ rendererPool ,
58
+ $ data ,
59
+ $ salableResolver ,
60
+ $ minimalPriceCalculator
61
+ );
62
+ }
63
+
20
64
/**
21
65
* Retrieve an item instance to the configured price model
22
66
*
@@ -60,7 +104,7 @@ public function getConfiguredPrice()
60
104
{
61
105
/** @var \Magento\Bundle\Pricing\Price\ConfiguredPrice $configuredPrice */
62
106
$ configuredPrice = $ this ->getPrice ();
63
- if (empty ($ configuredPrice -> getSelectionPriceList ())) {
107
+ if (empty ($ this -> configuredPriceSelection -> getSelectionPriceList ($ configuredPrice ))) {
64
108
// If there was no selection we must show minimal regular price
65
109
return $ this ->getSaleableItem ()->getPriceInfo ()->getPrice (FinalPrice::PRICE_CODE );
66
110
}
@@ -75,7 +119,7 @@ public function getConfiguredRegularPrice()
75
119
{
76
120
/** @var \Magento\Bundle\Pricing\Price\ConfiguredPrice $configuredPrice */
77
121
$ configuredPrice = $ this ->getPriceType (ConfiguredPriceInterface::CONFIGURED_REGULAR_PRICE_CODE );
78
- if (empty ($ configuredPrice -> getSelectionPriceList ())) {
122
+ if (empty ($ this -> configuredPriceSelection -> getSelectionPriceList ($ configuredPrice ))) {
79
123
// If there was no selection we must show minimal regular price
80
124
return $ this ->getSaleableItem ()->getPriceInfo ()->getPrice (RegularPrice::PRICE_CODE );
81
125
}
0 commit comments