Discount percentage rounded
This commit is contained in:
@@ -461,9 +461,15 @@ class ProductLazyArray extends AbstractLazyArray
|
||||
|
||||
if ($show_price && $this->product['reduction']) {
|
||||
if ($this->product['discount_type'] === 'percentage') {
|
||||
$discountLabel = $this->product['discount_percentage'];
|
||||
$num = floatval(str_replace(',', '.', preg_replace('/[^0-9,.-]/', '', $discountLabel)));
|
||||
$rounded = round($num);
|
||||
$discountLabel = sprintf('-%d%%', abs($rounded));
|
||||
|
||||
$flags['discount'] = [
|
||||
'type' => 'discount',
|
||||
'label' => $this->product['discount_percentage'],
|
||||
// 'label' => $this->product['discount_percentage'],
|
||||
'label' => $discountLabel,
|
||||
];
|
||||
} elseif ($this->product['discount_type'] === 'amount') {
|
||||
$flags['discount'] = [
|
||||
|
||||
Reference in New Issue
Block a user