Author Topic: Rounding issue  (Read 2608 times)

Malex

  • Beginner
  • *
  • Posts: 37
  • A beginner
    • WebComToYou!
  • VirtueMart Version: 3.0.17.4 | Joomla! 3.6.2
Rounding issue
« on: September 15, 2017, 15:17:10 pm »
Hello!

I have a bug setting rounded prices , if i set Final salesprice Rounding Digits to "0" and the Total tax amount rounding to "2", there is no effect on total tax amount, staying to "0" Rounding Digits
I tried the opposite, same problem, that's mean rounding final price and total tax are linked, hard to understand ..   :o
Please see attachements
Do you have an idea ?

Thanks a lot !



VM 3.2.4
Joomla 3.7.5

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3510
  • VirtueMart Version: 3.8.9
Re: Rounding issue
« Reply #1 on: September 15, 2017, 16:16:59 pm »
What are you expecting
What tax are you setting etc
Regards
A

Joomla 3.9.27
php 7.4

Malex

  • Beginner
  • *
  • Posts: 37
  • A beginner
    • WebComToYou!
  • VirtueMart Version: 3.0.17.4 | Joomla! 3.6.2
Re: Rounding issue
« Reply #2 on: September 15, 2017, 16:53:05 pm »
Hello,

i want 0 digit to Final salesprice and 2 digits to Total tax amount,
as youn can see in the second screen shot

Malex

  • Beginner
  • *
  • Posts: 37
  • A beginner
    • WebComToYou!
  • VirtueMart Version: 3.0.17.4 | Joomla! 3.6.2
Re: Rounding issue
« Reply #3 on: September 18, 2017, 10:03:41 am »
I spent a lot of time searching a solution, please
would anyone have a track, an idea of ​​the direction to look for ?

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10213
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Rounding issue
« Reply #4 on: September 18, 2017, 12:58:27 pm »
The tax for the products seems right. hmmm
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Malex

  • Beginner
  • *
  • Posts: 37
  • A beginner
    • WebComToYou!
  • VirtueMart Version: 3.0.17.4 | Joomla! 3.6.2
Re: Rounding issue
« Reply #5 on: September 18, 2017, 16:42:27 pm »
The tax for the products seems right. hmmm
The tax calculation is not the problem, the problem is tax rounding;
In admin > configuration > prices
When i set Final salesprice Rounding Digits to "0"
and
i set the Total tax amount rounding to "2",
no effect on total tax amount, staying to "0" Rounding Digits
see the second attachement "wrong" to see what i mean.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10213
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Rounding issue
« Reply #6 on: September 20, 2017, 21:11:48 pm »
yes, I noticed it. I just meant, that it is correct above. It is on my todo list.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Malex

  • Beginner
  • *
  • Posts: 37
  • A beginner
    • WebComToYou!
  • VirtueMart Version: 3.0.17.4 | Joomla! 3.6.2
Re: Rounding issue
« Reply #7 on: September 22, 2017, 08:16:30 am »
Thanks for your reply. Do you thing i may apply some modifications in some files to make this work waiting for resolution ?

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10213
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Rounding issue
« Reply #8 on: September 22, 2017, 10:08:03 am »
I put it on my todo list, if you want to have it faster, help us, do it yourself and share the code here, or consider to buy a membership. http://extensions.virtuemart.net/support/virtuemart-supporter-membership-bronze-detail

The reason for the error is simple. The rounding of the final price is just the fallback of any non defined price. And the tax total is not defined.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Malex

  • Beginner
  • *
  • Posts: 37
  • A beginner
    • WebComToYou!
  • VirtueMart Version: 3.0.17.4 | Joomla! 3.6.2
Re: Rounding issue
« Reply #9 on: September 22, 2017, 10:46:08 am »
Oh, mmm..
I'm afraid I do not have enough skills to find by myself ..
I searched for a long time..I will try again but it is a difficult problem to understand since there are 2 separate fields which one can change attributes in administration , without result...
I will consider buying a membership anyway but not sure that this will solve the problem
 ;)

Have a nice day

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10213
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Rounding issue
« Reply #10 on: September 22, 2017, 11:03:36 am »
This lines here echo $this->currencyDisplay->createPriceDiv ('basePriceVariant', '', $prow->prices, FALSE, FALSE, 1.0, false, true);

or the line you need to change
echo "<span  class='priceColor2'>" . $this->currencyDisplay->createPriceDiv ('billTaxAmount', '', $this->cart->cartPrices['billTaxAmount'], FALSE)

When you go to the function createPriceDiv, you will see this
Code: [Select]
//The fallback, when this price is not configured
if(empty($this->_priceConfig[$name])){
$this->_priceConfig[$name] = $this->_priceConfig['salesPrice'];
}

So you need to provide the $this->_priceConfig['billTaxAmount'] with the right array $this->_priceConfig['billTaxAmount'][0]=true and $this->_priceConfig['billTaxAmount'][1]=2 and $this->_priceConfig['billTaxAmount'][2] = true.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/