17
17
use Magento \Framework \Pricing \SaleableInterface ;
18
18
use Magento \Framework \View \Element \Template \Context ;
19
19
20
+ /**
21
+ * Class for final_price box rendering
22
+ */
20
23
class FinalPriceBox extends \Magento \Catalog \Pricing \Render \FinalPriceBox
21
24
{
22
25
/**
23
26
* @var LowestPriceOptionsProviderInterface
24
27
*/
25
28
private $ lowestPriceOptionsProvider ;
26
29
30
+ /**
31
+ * @var ConfigurableOptionsProviderInterface
32
+ */
33
+ private $ configurableOptionsProvider ;
34
+
27
35
/**
28
36
* @param Context $context
29
37
* @param SaleableInterface $saleableItem
@@ -34,7 +42,6 @@ class FinalPriceBox extends \Magento\Catalog\Pricing\Render\FinalPriceBox
34
42
* @param LowestPriceOptionsProviderInterface $lowestPriceOptionsProvider
35
43
* @param SalableResolverInterface|null $salableResolver
36
44
* @param MinimalPriceCalculatorInterface|null $minimalPriceCalculator
37
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
38
45
*/
39
46
public function __construct (
40
47
Context $ context ,
@@ -56,6 +63,7 @@ public function __construct(
56
63
$ salableResolver ,
57
64
$ minimalPriceCalculator
58
65
);
66
+ $ this ->configurableOptionsProvider = $ configurableOptionsProvider ;
59
67
$ this ->lowestPriceOptionsProvider = $ lowestPriceOptionsProvider ?:
60
68
ObjectManager::getInstance ()->get (LowestPriceOptionsProviderInterface::class);
61
69
}
@@ -68,7 +76,7 @@ public function __construct(
68
76
public function hasSpecialPrice ()
69
77
{
70
78
$ product = $ this ->getSaleableItem ();
71
- foreach ($ this ->lowestPriceOptionsProvider ->getProducts ($ product ) as $ subProduct ) {
79
+ foreach ($ this ->configurableOptionsProvider ->getProducts ($ product ) as $ subProduct ) {
72
80
$ regularPrice = $ subProduct ->getPriceInfo ()->getPrice (RegularPrice::PRICE_CODE )->getValue ();
73
81
$ finalPrice = $ subProduct ->getPriceInfo ()->getPrice (FinalPrice::PRICE_CODE )->getValue ();
74
82
if ($ finalPrice < $ regularPrice ) {
0 commit comments