VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Malex on September 15, 2017, 15:17:10 PM

Title: Rounding issue
Post by: Malex 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
Title: Re: Rounding issue
Post by: AH on September 15, 2017, 16:16:59 PM
What are you expecting
What tax are you setting etc
Title: Re: Rounding issue
Post by: Malex 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
Title: Re: Rounding issue
Post by: Malex 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 ?
Title: Re: Rounding issue
Post by: Milbo on September 18, 2017, 12:58:27 PM
The tax for the products seems right. hmmm
Title: Re: Rounding issue
Post by: Malex on September 18, 2017, 16:42:27 PM
Quote from: Milbo on September 18, 2017, 12:58: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.
Title: Re: Rounding issue
Post by: Milbo 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.
Title: Re: Rounding issue
Post by: Malex 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 ?
Title: Re: Rounding issue
Post by: Milbo 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.
Title: Re: Rounding issue
Post by: Malex 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
Title: Re: Rounding issue
Post by: Milbo 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

//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.