News:

Support the VirtueMart project and become a member

Main Menu

Show discount amount of a product, but WITH tax

Started by thefbi, May 22, 2020, 17:52:05 PM

Previous topic - Next topic

thefbi

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

AH

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
Regards
A

Joomla 3.10.11
php 8.0

thefbi

#2
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% ?

thefbi

#3
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

GJC Web Design


<?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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

thefbi

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 !