Skip to content

Commit 5d562bb

Browse files
committed
ACP2E-1634: display taxes according to tax configuration
1 parent 3218b12 commit 5d562bb

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $regularPriceAttributes = [
2222
'display_label' => __('Regular Price'),
2323
'price_id' => $block->getPriceId('old-price-' . $idSuffix),
2424
'include_container' => true,
25-
'skip_adjustments' => true
25+
'skip_adjustments' => false
2626
];
2727
$renderMinimalRegularPrice = $block->renderAmount($minimalRegularPrice, $regularPriceAttributes);
2828
?>

app/code/Magento/Catalog/Pricing/Price/MinimalTierPriceCalculator.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
namespace Magento\Catalog\Pricing\Price;
88

9-
use Magento\Framework\Pricing\SaleableInterface;
109
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
1110
use Magento\Framework\Pricing\Amount\AmountInterface;
11+
use Magento\Framework\Pricing\SaleableInterface;
1212

1313
/**
1414
* As Low As shows minimal value of Tier Prices
@@ -20,12 +20,18 @@ class MinimalTierPriceCalculator implements MinimalPriceCalculatorInterface
2020
*/
2121
private $calculator;
2222

23+
/**
24+
* @var null
25+
*/
26+
private $lowestTierPrice;
27+
2328
/**
2429
* @param CalculatorInterface $calculator
2530
*/
2631
public function __construct(CalculatorInterface $calculator)
2732
{
2833
$this->calculator = $calculator;
34+
$this->lowestTierPrice = null;
2935
}
3036

3137
/**
@@ -39,15 +45,19 @@ public function getValue(SaleableInterface $saleableItem)
3945
/** @var TierPrice $price */
4046
$price = $saleableItem->getPriceInfo()->getPrice(TierPrice::PRICE_CODE);
4147
$tierPriceList = $price->getTierPriceList();
48+
$finalPrice = $saleableItem->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue();
4249

43-
$tierPrices = [];
50+
$minPrice = $finalPrice;
4451
foreach ($tierPriceList as $tierPrice) {
4552
/** @var AmountInterface $price */
4653
$price = $tierPrice['price'];
47-
$tierPrices[] = $price->getValue();
54+
if ($minPrice > $price->getValue()) {
55+
$minPrice = $price->getValue();
56+
$this->lowestTierPrice = $price;
57+
}
4858
}
4959

50-
return $tierPrices ? min($tierPrices) : null;
60+
return $this->lowestTierPrice?->getValue();
5161
}
5262

5363
/**
@@ -59,9 +69,6 @@ public function getValue(SaleableInterface $saleableItem)
5969
public function getAmount(SaleableInterface $saleableItem)
6070
{
6171
$value = $this->getValue($saleableItem);
62-
63-
return $value === null
64-
? null
65-
: $this->calculator->getAmount($value, $saleableItem, 'tax');
72+
return $value === null ? null : $this->lowestTierPrice;
6673
}
6774
}

app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66

77
namespace Magento\Catalog\Pricing\Render;
88

9-
use Magento\Catalog\Pricing\Price;
10-
use Magento\Framework\Pricing\Render\PriceBox as BasePriceBox;
11-
use Magento\Msrp\Pricing\Price\MsrpPrice;
129
use Magento\Catalog\Model\Product\Pricing\Renderer\SalableResolverInterface;
13-
use Magento\Framework\View\Element\Template\Context;
14-
use Magento\Framework\Pricing\SaleableInterface;
10+
use Magento\Catalog\Pricing\Price;
11+
use Magento\Catalog\Pricing\Price\MinimalPriceCalculatorInterface;
12+
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
1514
use Magento\Framework\Pricing\Price\PriceInterface;
15+
use Magento\Framework\Pricing\Render\PriceBox as BasePriceBox;
1616
use Magento\Framework\Pricing\Render\RendererPool;
17-
use Magento\Framework\App\ObjectManager;
18-
use Magento\Catalog\Pricing\Price\MinimalPriceCalculatorInterface;
17+
use Magento\Framework\Pricing\SaleableInterface;
18+
use Magento\Framework\View\Element\Template\Context;
19+
use Magento\Msrp\Pricing\Price\MsrpPrice;
1920

2021
/**
2122
* Class for final_price rendering
@@ -140,7 +141,7 @@ public function renderAmountMinimal()
140141
'display_label' => __('As low as'),
141142
'price_id' => $id,
142143
'include_container' => false,
143-
'skip_adjustments' => true
144+
'skip_adjustments' => false
144145
]
145146
);
146147
}
@@ -183,7 +184,7 @@ public function showMinimalPrice()
183184
public function getCacheKey()
184185
{
185186
return parent::getCacheKey()
186-
. ($this->getData('list_category_page') ? '-list-category-page': '')
187+
. ($this->getData('list_category_page') ? '-list-category-page' : '')
187188
. ($this->getSaleableItem()->getCustomerGroupId() ?? '');
188189
}
189190

app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $schema = ($block->getZone() == 'item_view') ? true : false;
3434
'price_id' => $block->getPriceId('old-price-' . $idSuffix),
3535
'price_type' => 'oldPrice',
3636
'include_container' => true,
37-
'skip_adjustments' => true
37+
'skip_adjustments' => false
3838
]); ?>
3939
</span>
4040
<?php else :?>

0 commit comments

Comments
 (0)