Skip to content

Commit

Permalink
Edits for bug magento/magento2/#11998
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Krielen committed Apr 12, 2020
1 parent 86515dd commit 65c06eb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/code/Magento/Catalog/Block/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ public function getJsonConfig()
'productId' => (int)$product->getId(),
'priceFormat' => $this->_localeFormat->getPriceFormat(),
'prices' => [
'baseOldPrice' => [
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getBaseAmount() * 1,
'adjustments' => []
],
'oldPrice' => [
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getValue() * 1,
'adjustments' => []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ protected function getOptionPrices()

$prices[$product->getId()] =
[
'baseOldPrice' => [
'amount' => $this->localeFormat->getNumber(
$priceInfo->getPrice('regular_price')->getAmount()->getBaseAmount()
),
],
'oldPrice' => [
'amount' => $this->localeFormat->getNumber(
$priceInfo->getPrice('regular_price')->getAmount()->getValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public function getFormattedPrices(\Magento\Framework\Pricing\PriceInfo\Base $pr
$finalPrice = $priceInfo->getPrice('final_price');

return [
'baseOldPrice' => [
'amount' => $this->localeFormat->getNumber($regularPrice->getAmount()->getBaseAmount()),
],
'oldPrice' => [
'amount' => $this->localeFormat->getNumber($regularPrice->getAmount()->getValue()),
],
Expand Down
13 changes: 13 additions & 0 deletions app/code/Magento/Tax/Pricing/Render/Adjustment.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,17 @@ public function displayPriceExcludingTax()
{
return $this->taxHelper->displayPriceExcludingTax();
}

/**
* Obtain a value for data-price-type attribute
*
* @return string
*/
public function getDataPriceType()
{
if ( $this->getData('price_type') !== 'finalPrice' && $priceType = $this->getData('price_type')) {
return 'base' . ucfirst($priceType);
}
return 'basePrice';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
?>

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

<?php if ($block->displayBothPrices()) : ?>
<span id="<?= $block->escapeHtmlAttr($block->buildIdWithPrefix('price-excluding-tax-')) ?>"
data-label="<?= $block->escapeHtmlAttr(__('Excl. Tax')) ?>"
<span id="<?= $escaper->escapeHtmlAttr($block->buildIdWithPrefix('price-excluding-tax-')) ?>"
data-label="<?= $escaper->escapeHtmlAttr(__('Excl. Tax')) ?>"
data-price-amount="<?= /* @noEscape */ $block->getRawAmount() ?>"
data-price-type="basePrice"
data-price-type="<?= $escaper->escapeHtmlAttr($block->getDataPriceType()); ?>"
class="price-wrapper price-excluding-tax">
<span class="price"><?= /* @noEscape */ $block->getDisplayAmountExclTax() ?></span></span>
<?php endif; ?>

0 comments on commit 65c06eb

Please sign in to comment.