Author Topic: Show discount amount of a product, but WITH tax  (Read 528 times)

thefbi

  • Jr. Member
  • **
  • Posts: 168
Show discount amount of a product, but WITH tax
« 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

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3165
  • VirtueMart Version: 3.6.11
Re: Show discount amount of a product, but WITH tax
« Reply #1 on: May 23, 2020, 09:49:23 am »
it will be the same %age

Quote
The 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.9.18
php 7.3

thefbi

  • Jr. Member
  • **
  • Posts: 168
Re: Show discount amount of a product, but WITH tax
« Reply #2 on: May 23, 2020, 15:57:27 pm »
Hello,
the code i use is :
Code: [Select]
<?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

  • Jr. Member
  • **
  • Posts: 168
Re: Show discount amount of a product, but WITH tax
« Reply #3 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

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9650
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Show discount amount of a product, but WITH tax
« Reply #4 on: May 23, 2020, 18:59:41 pm »
Code: [Select]
<?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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

thefbi

  • Jr. Member
  • **
  • Posts: 168
Re: Show discount amount of a product, but WITH tax
« Reply #5 on: Yesterday at 14:53:10 »
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 !