VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: thefbi on May 22, 2020, 17:52:05 PM

Title: Show discount amount of a product, but WITH tax
Post by: thefbi on May 22, 2020, 17:52:05 PM
Hello,
i have a little problem. I want to show the discount amount of a product, but WITH tax.

As you can see here, the discount amount is 10%, but actually, it is without tax. I want to show the amount WITH tax.
https://lampedesign.ch/index.php/manufacturer/baltensweiler

The code i have is only without tax and i cant figure out how make it work with tax.
Any idea ?

VM 3.6.10 10211
Joomla 3.9.18
Title: Re: Show discount amount of a product, but WITH tax
Post by: AH on May 23, 2020, 09:49:23 AM
it will be the same %age

QuoteThe code i have is only without tax and i cant figure out how make it work with tax.
My crystal ball is broken !

It depends on what you have set for discount rules and what you show on a product to the customer
Title: Re: Show discount amount of a product, but WITH tax
Post by: thefbi on May 23, 2020, 15:57:27 PM
Hello,
the code i use is :
<?php
if(!(isset($currency))){
$currency CurrencyDisplay::getInstance ();
}
echo 
$currency->createPriceDiv ('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$product->prices);
?>


I use discount rules : price modification before tax by product, 10%.

Perhaps it is possible to add in the code a calculate code that make the discount amount + 7.7% ?
Title: Re: Show discount amount of a product, but WITH tax
Post by: thefbi on May 23, 2020, 16:04:20 PM
And here is a screenshot with the prices used.

1'572.40 - 10% = 1'415.20

10% = 157.24

Here, it is 146.-

My tax is 7.7% so you make 146 + 7.7% = 157.24
Title: Re: Show discount amount of a product, but WITH tax
Post by: GJC Web Design on May 23, 2020, 18:59:41 PM

<?php
if(!(isset($currency))){
$currency CurrencyDisplay::getInstance ();
}
$dis $product->prices['discountAmount'] *1.077;
echo 
'<span class="price-crossed">'.$currency->getFormattedCurrency ($dis2).'</span>';
?>



or get the tax rate programatically
Title: Re: Show discount amount of a product, but WITH tax
Post by: thefbi on May 28, 2020, 14:53:10 PM
Hello, thank you it work like this :)

Sorry for late response, but i did not receive the email alerte anytime with this forum... I dont know why.
Thanks again !