@@ -31,7 +31,6 @@ class MinimalTierPriceCalculator implements MinimalPriceCalculatorInterface
31
31
public function __construct (CalculatorInterface $ calculator )
32
32
{
33
33
$ this ->calculator = $ calculator ;
34
- $ this ->lowestTierPrice = null ;
35
34
}
36
35
37
36
/**
@@ -42,6 +41,20 @@ public function __construct(CalculatorInterface $calculator)
42
41
*/
43
42
public function getValue (SaleableInterface $ saleableItem )
44
43
{
44
+ return $ this ->getAmount ($ saleableItem )?->getValue();
45
+ }
46
+
47
+ /**
48
+ * Return calculated amount object that keeps "as low as" value{@inheritdoc}
49
+ *
50
+ * @param SaleableInterface $saleableItem
51
+ * @return AmountInterface|null
52
+ */
53
+ public function getAmount (SaleableInterface $ saleableItem )
54
+ {
55
+ $ value = $ this ->getValue ($ saleableItem );
56
+ return $ value === null ? null : $ this ->lowestTierPrice ;
57
+
45
58
$ this ->lowestTierPrice = null ;
46
59
/** @var TierPrice $price */
47
60
$ tierPrice = $ saleableItem ->getPriceInfo ()->getPrice (TierPrice::PRICE_CODE );
@@ -58,18 +71,6 @@ public function getValue(SaleableInterface $saleableItem)
58
71
}
59
72
}
60
73
61
- return $ this ->lowestTierPrice ?->getValue();
62
- }
63
-
64
- /**
65
- * Return calculated amount object that keeps "as low as" value{@inheritdoc}
66
- *
67
- * @param SaleableInterface $saleableItem
68
- * @return AmountInterface|null
69
- */
70
- public function getAmount (SaleableInterface $ saleableItem )
71
- {
72
- $ value = $ this ->getValue ($ saleableItem );
73
- return $ value === null ? null : $ this ->lowestTierPrice ;
74
+ return $ this ->lowestTierPrice ;
74
75
}
75
76
}
0 commit comments