File tree 2 files changed +14
-2
lines changed
view/base/templates/product/price 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -69,9 +69,11 @@ public function jsonEncode($valueToEncode)
69
69
/**
70
70
* Get random string
71
71
*
72
- * @param int $length
72
+ * @param int $length
73
73
* @param string|null $chars
74
+ *
74
75
* @return string
76
+ * @throws \Magento\Framework\Exception\LocalizedException
75
77
*/
76
78
public function getRandomString ($ length , $ chars = null )
77
79
{
@@ -93,4 +95,14 @@ public function getCanDisplayQty(Product $product)
93
95
}
94
96
return true ;
95
97
}
98
+
99
+ /**
100
+ * @param float $percent
101
+ *
102
+ * @return string
103
+ */
104
+ public function formatPercent (float $ percent ):string
105
+ {
106
+ return rtrim (number_format ($ percent , 2 ), '.0 ' );
107
+ }
96
108
}
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ $product = $block->getSaleableItem();
77
77
$ price ['price_qty ' ],
78
78
$ priceAmountBlock ,
79
79
$ index ,
80
- $ tierPriceModel ->getSavePercent ($ price ['price ' ])
80
+ $ block -> formatPercent ( $ price [ ' percentage_value ' ] ?? $ tierPriceModel ->getSavePercent ($ price ['price ' ]) )
81
81
)
82
82
: __ ('Buy %1 for %2 each ' , $ price ['price_qty ' ], $ priceAmountBlock );
83
83
?>
You can’t perform that action at this time.
0 commit comments