File tree Expand file tree Collapse file tree 5 files changed +29
-3
lines changed
Model/Product/Type/Configurable/Variations
view/base/templates/pricing Expand file tree Collapse file tree 5 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,10 @@ public function getJsonConfig()
196
196
'productId ' => (int )$ product ->getId (),
197
197
'priceFormat ' => $ this ->_localeFormat ->getPriceFormat (),
198
198
'prices ' => [
199
+ 'baseOldPrice ' => [
200
+ 'amount ' => $ priceInfo ->getPrice ('regular_price ' )->getAmount ()->getBaseAmount () * 1 ,
201
+ 'adjustments ' => []
202
+ ],
199
203
'oldPrice ' => [
200
204
'amount ' => $ priceInfo ->getPrice ('regular_price ' )->getAmount ()->getValue () * 1 ,
201
205
'adjustments ' => []
Original file line number Diff line number Diff line change @@ -303,6 +303,11 @@ protected function getOptionPrices()
303
303
304
304
$ prices [$ product ->getId ()] =
305
305
[
306
+ 'baseOldPrice ' => [
307
+ 'amount ' => $ this ->localeFormat ->getNumber (
308
+ $ priceInfo ->getPrice ('regular_price ' )->getAmount ()->getBaseAmount ()
309
+ ),
310
+ ],
306
311
'oldPrice ' => [
307
312
'amount ' => $ this ->localeFormat ->getNumber (
308
313
$ priceInfo ->getPrice ('regular_price ' )->getAmount ()->getValue ()
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ public function getFormattedPrices(\Magento\Framework\Pricing\PriceInfo\Base $pr
39
39
$ finalPrice = $ priceInfo ->getPrice ('final_price ' );
40
40
41
41
return [
42
+ 'baseOldPrice ' => [
43
+ 'amount ' => $ this ->localeFormat ->getNumber ($ regularPrice ->getAmount ()->getBaseAmount ()),
44
+ ],
42
45
'oldPrice ' => [
43
46
'amount ' => $ this ->localeFormat ->getNumber ($ regularPrice ->getAmount ()->getValue ()),
44
47
],
Original file line number Diff line number Diff line change @@ -173,4 +173,17 @@ public function displayPriceExcludingTax()
173
173
{
174
174
return $ this ->taxHelper ->displayPriceExcludingTax ();
175
175
}
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
+ }
176
189
}
Original file line number Diff line number Diff line change 6
6
?>
7
7
8
8
<?php /** @var \Magento\Tax\Pricing\Render\Adjustment $block */ ?>
9
+ <?php /** @var $escaper \Magento\Framework\Escaper */ ?>
9
10
10
11
<?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 ' )) ?> "
13
14
data-price-amount="<?= /* @noEscape */ $ block ->getRawAmount () ?> "
14
- data-price-type="basePrice "
15
+ data-price-type="<?= $ escaper -> escapeHtmlAttr ( $ block -> getDataPriceType ()); ?> "
15
16
class="price-wrapper price-excluding-tax">
16
17
<span class="price"><?= /* @noEscape */ $ block ->getDisplayAmountExclTax () ?> </span></span>
17
18
<?php endif ; ?>
You can’t perform that action at this time.
0 commit comments