Hello! Does anybody know hoy you can show the discount percentage in the product badge? im using virtuemart 3.2.14 Regards!
Please check: https://extensions.joomla.org/extension/vm-discount-percent-badge/
You can make an override for the productdetails layout and calculate the percentage there.
It's just a simple calculation like this:
if ($product->prices['basePriceWithTax'] != 0) { // with tax
$percentDiscount = round($product->prices['discountAmount'] / $product->prices['basePriceWithTax'] * 100, 0);
} elseif ($product->prices['basePrice'] != 0) { // without tax
$percentDiscount = round($product->prices['discountAmount'] / $product->prices['basePrice'] * 100, 0);
}
Quote from: StefanSTS on June 17, 2019, 13:01:15 PM
You can make an override for the productdetails layout and calculate the percentage there.
It's just a simple calculation like this:
if ($product->prices['basePriceWithTax'] != 0) { // with tax
$percentDiscount = round($product->prices['discountAmount'] / $product->prices['basePriceWithTax'] * 100, 0);
} elseif ($product->prices['basePrice'] != 0) { // without tax
$percentDiscount = round($product->prices['discountAmount'] / $product->prices['basePrice'] * 100, 0);
}
Thank you! how do you apply this? regards!
Hi,
please check this plugin:
https://www.minijoomla.org/extensions/virtuemart-extensions/product-labels-for-virtuemart
One from 9 labels is sale with percent.
Three labels are added as new checkbox in product detail in administration.
For labels you can setup color or picture
Rudolf