News:

Looking for documentation? Take a look on our wiki

Main Menu

Show Discount as %

Started by CMYKreative, August 14, 2012, 12:45:40 PM

Previous topic - Next topic

AH

admis

Create an override
This might work for you:-

templates/your template/html/com_virtuemart/productdetails/default_showprices.php

Then add this to the pricing layout



//quorvia created discount percentage calculation and display to replace the discount value
if (round($this->product->prices['discountAmount'] != 0 )) {
$discount_percent = round(($this->product->prices['basePriceWithTax'] - $this->product->prices['salesPrice']) * 100 / $this->product->prices['basePriceWithTax']);
?>
        <div class="discountAmount">
            Save <?php echo $discount_percent?>%
        </div>
<?php
}



It works for me and the "div" allow you to position and color as required
Regards
A

Joomla 4.4.5
php 8.1

admiss

Maybe I've pasted it on wrong place...
Front end: Warn­ing: Divi­sion by zero in /var/www/clients/client186/web266/web/templates/sj_bakery/html/com_virtuemart/productdetails/default_showprices.php on line 43
Save 0%
Thats what I was talking about...related to touching php-s...So I suppose, there is no possibility to solve it in Joomla BE, in e.g. VM Config (Pricing)