15
15
use Magento \Framework \Locale \Format ;
16
16
use Magento \Framework \Pricing \PriceCurrencyInterface ;
17
17
use Magento \Store \Model \Store ;
18
- use Magento \Framework \App \Config \ScopeConfigInterface ;
19
- use Magento \Tax \Model \Config ;
20
18
21
19
/**
22
20
* Confugurable product view type
27
25
*/
28
26
class Configurable extends \Magento \Catalog \Block \Product \View \AbstractView
29
27
{
30
- private const XML_PATH_TAX_DISPLAY_TYPE = 'tax/display/type ' ;
31
-
32
28
/**
33
29
* @var \Magento\Catalog\Helper\Product
34
30
*/
@@ -82,11 +78,6 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView
82
78
*/
83
79
private $ variationPrices ;
84
80
85
- /**
86
- * @var ScopeConfigInterface
87
- */
88
- private $ scopeConfig ;
89
-
90
81
/**
91
82
* @param \Magento\Catalog\Block\Product\Context $context
92
83
* @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils
@@ -100,7 +91,6 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView
100
91
* @param Format|null $localeFormat
101
92
* @param Session|null $customerSession
102
93
* @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Variations\Prices|null $variationPrices
103
- * @param ScopeConfigInterface|null $scopeConfig
104
94
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
105
95
*/
106
96
public function __construct (
@@ -115,8 +105,7 @@ public function __construct(
115
105
array $ data = [],
116
106
Format $ localeFormat = null ,
117
107
Session $ customerSession = null ,
118
- \Magento \ConfigurableProduct \Model \Product \Type \Configurable \Variations \Prices $ variationPrices = null ,
119
- ?ScopeConfigInterface $ scopeConfig = null
108
+ \Magento \ConfigurableProduct \Model \Product \Type \Configurable \Variations \Prices $ variationPrices = null
120
109
) {
121
110
$ this ->priceCurrency = $ priceCurrency ;
122
111
$ this ->helper = $ helper ;
@@ -129,7 +118,6 @@ public function __construct(
129
118
$ this ->variationPrices = $ variationPrices ?: ObjectManager::getInstance ()->get (
130
119
\Magento \ConfigurableProduct \Model \Product \Type \Configurable \Variations \Prices::class
131
120
);
132
- $ this ->scopeConfig = $ scopeConfig ?: ObjectManager::getInstance ()->get (ScopeConfigInterface::class);
133
121
134
122
parent ::__construct (
135
123
$ context ,
@@ -344,38 +332,29 @@ private function getTierPricesByProduct(ProductInterface $product): array
344
332
$ tierPrices = [];
345
333
$ tierPriceModel = $ product ->getPriceInfo ()->getPrice ('tier_price ' );
346
334
foreach ($ tierPriceModel ->getTierPriceList () as $ tierPrice ) {
347
- $ price = $ this ->localeFormat ->getNumber ($ tierPrice ['price ' ]->getValue ());
348
- if ($ this ->getConfigTaxDisplayType () === Config::DISPLAY_TYPE_EXCLUDING_TAX ) {
349
- $ price = $ this ->localeFormat ->getNumber ($ tierPrice ['price ' ]->getBaseAmount ());
350
- }
351
335
$ tierPriceData = [
352
336
'qty ' => $ this ->localeFormat ->getNumber ($ tierPrice ['price_qty ' ]),
353
- 'price ' => $ price ,
337
+ 'price ' => $ this -> localeFormat -> getNumber ( $ tierPrice [ ' price ' ]-> getValue ()) ,
354
338
'percentage ' => $ this ->localeFormat ->getNumber (
355
339
$ tierPriceModel ->getSavePercent ($ tierPrice ['price ' ])
356
340
),
357
341
];
358
342
359
343
if (isset ($ tierPrice ['excl_tax_price ' ])) {
360
- $ excludingTax = $ tierPrice ['excl_tax_price ' ];
361
- $ tierPriceData ['excl_tax_price ' ] = $ this ->localeFormat ->getNumber ($ excludingTax ->getBaseAmount ());
344
+ $ exclTax = $ tierPrice ['excl_tax_price ' ];
345
+ $ tierPriceData ['excl_tax_price ' ] = $ this ->localeFormat ->getNumber ($ exclTax ->getBaseAmount ());
346
+ }
347
+
348
+ if (isset ($ tierPrice ['incl_excl_tax_price ' ])) {
349
+ $ inclExclTax = $ tierPrice ['incl_excl_tax_price ' ];
350
+ $ tierPriceData ['incl_excl_tax_price ' ] = $ this ->localeFormat ->getNumber ($ inclExclTax ->getBaseAmount ());
362
351
}
363
352
$ tierPrices [] = $ tierPriceData ;
364
353
}
365
354
366
355
return $ tierPrices ;
367
356
}
368
357
369
- /**
370
- * Returns config tax display type
371
- *
372
- * @return int
373
- */
374
- private function getConfigTaxDisplayType (): int
375
- {
376
- return (int ) $ this ->scopeConfig ->getValue (self ::XML_PATH_TAX_DISPLAY_TYPE );
377
- }
378
-
379
358
/**
380
359
* Replace ',' on '.' for js
381
360
*
0 commit comments