Skip to content

Commit 65c06eb

Browse files
author
Jack Krielen
committed
Edits for bug magento/magento2/#11998
1 parent 86515dd commit 65c06eb

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

app/code/Magento/Catalog/Block/Product/View.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ public function getJsonConfig()
196196
'productId' => (int)$product->getId(),
197197
'priceFormat' => $this->_localeFormat->getPriceFormat(),
198198
'prices' => [
199+
'baseOldPrice' => [
200+
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getBaseAmount() * 1,
201+
'adjustments' => []
202+
],
199203
'oldPrice' => [
200204
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getValue() * 1,
201205
'adjustments' => []

app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ protected function getOptionPrices()
303303

304304
$prices[$product->getId()] =
305305
[
306+
'baseOldPrice' => [
307+
'amount' => $this->localeFormat->getNumber(
308+
$priceInfo->getPrice('regular_price')->getAmount()->getBaseAmount()
309+
),
310+
],
306311
'oldPrice' => [
307312
'amount' => $this->localeFormat->getNumber(
308313
$priceInfo->getPrice('regular_price')->getAmount()->getValue()

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Variations/Prices.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public function getFormattedPrices(\Magento\Framework\Pricing\PriceInfo\Base $pr
3939
$finalPrice = $priceInfo->getPrice('final_price');
4040

4141
return [
42+
'baseOldPrice' => [
43+
'amount' => $this->localeFormat->getNumber($regularPrice->getAmount()->getBaseAmount()),
44+
],
4245
'oldPrice' => [
4346
'amount' => $this->localeFormat->getNumber($regularPrice->getAmount()->getValue()),
4447
],

app/code/Magento/Tax/Pricing/Render/Adjustment.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,17 @@ public function displayPriceExcludingTax()
173173
{
174174
return $this->taxHelper->displayPriceExcludingTax();
175175
}
176+
177+
/**
178+
* Obtain a value for data-price-type attribute
179+
*
180+
* @return string
181+
*/
182+
public function getDataPriceType()
183+
{
184+
if ( $this->getData('price_type') !== 'finalPrice' && $priceType = $this->getData('price_type')) {
185+
return 'base' . ucfirst($priceType);
186+
}
187+
return 'basePrice';
188+
}
176189
}

app/code/Magento/Tax/view/base/templates/pricing/adjustment.phtml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
?>
77

88
<?php /** @var \Magento\Tax\Pricing\Render\Adjustment $block */ ?>
9+
<?php /** @var $escaper \Magento\Framework\Escaper */ ?>
910

1011
<?php if ($block->displayBothPrices()) : ?>
11-
<span id="<?= $block->escapeHtmlAttr($block->buildIdWithPrefix('price-excluding-tax-')) ?>"
12-
data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"
12+
<span id="<?= $escaper->escapeHtmlAttr($block->buildIdWithPrefix('price-excluding-tax-')) ?>"
13+
data-label="<?= $escaper->escapeHtmlAttr(__('Excl. Tax')) ?>"
1314
data-price-amount="<?= /* @noEscape */ $block->getRawAmount() ?>"
14-
data-price-type="basePrice"
15+
data-price-type="<?= $escaper->escapeHtmlAttr($block->getDataPriceType()); ?>"
1516
class="price-wrapper price-excluding-tax">
1617
<span class="price"><?= /* @noEscape */ $block->getDisplayAmountExclTax() ?></span></span>
1718
<?php endif; ?>

0 commit comments

Comments
 (0)