Forums / Contribution-Writing Guidelines / need help with tax calculations

need help with tax calculations

Views: 6,751

Results 1 to 7 of 7
29 Aug 2015, 2:27 AM
#1
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

need help with tax calculations

I'm doing some customizations to a non-stock shipping module and am running into a little problem. When shipping is configured to be taxed it is coming in off by a penny sometimes, it's a rounding issue and after a bunch of testing I have narrowed it to the tax added from shipping. So, on the checkout page the combined tax in the cart is off if it should be rounded up, such as $4.2567 is what is calculated at the configured tax rate. It's returning $4.25 instead of $4.26. I need to know where the shipping tax is added to the total tax so I can see if it's using zen_round. I've been looking around for hours and hours now trying to figure out where the shipping tax is calculated and also where it's added to the product tax to get the total. It has been a really long time since I did some serious zen coding and I am pretty rusty with the structure of how it all ties together. I've been looking in class and function files but haven't located it.

Can you please point out which file(s) I need to be checking for the shipping tax calculation and where it's added to the cart tax?


Zen Cart and it's community are the best!!

29 Aug 2015, 6:15 AM
#2
lruskauff avatar

lruskauff

Totally Zenned

Join Date:
Sep 2008
Location:
WA
Posts:
559
Plugin Contributions:
0

Re: need help with tax calculations

I believe it is calculated in

/includes/modules/order_total/ot_shipping.php

29 Aug 2015, 7:30 PM
#3
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: need help with tax calculations

Thanks, I had looked there but after even more testing I see it's not the shipping, it's when items are on sale. I thought I had that issue worked out, and it is with the displayed price of the sale items. I also had altered the various number_format functions in functions_prices to round to 2 decimal places so I am not sure where I am getting this issue.


Zen Cart and it's community are the best!!

29 Aug 2015, 8:51 PM
#4
lruskauff avatar

lruskauff

Totally Zenned

Join Date:
Sep 2008
Location:
WA
Posts:
559
Plugin Contributions:
0

Re: need help with tax calculations

lankeeyankee:

Thanks, I had looked there but after even more testing I see it's not the shipping, it's when items are on sale. I thought I had that issue worked out, and it is with the displayed price of the sale items. I also had altered the various number_format functions in functions_prices to round to 2 decimal places so I am not sure where I am getting this issue.
It is kind of hard to know without knowing more about your site and what code you changed. If you can answer some of the posting questions it would help.

29 Aug 2015, 10:08 PM
#5
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: need help with tax calculations

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

29 Aug 2015, 11:22 PM
#7
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: need help with tax calculations

Thanks. Yes, I have looked at both threads and had thought Frank's fix would do it. The strange thing is, after a bunch more testing it seems random. I can't make any sense of the issue, I think it's one thing then after more testing show that it's not then come up with another idea and that's not it either. Hahaha. I have decided since it's not happening every time, on one item on special I get the error with one item but not on multiples of the item regardless of quantity the tax is always rounding correctly. My cart is highly customized so it would be difficult to pin it down and for the 10 or 20 cents per quarter difference it's not worth it to me since we are undercharging the tax and I can just make it up when paying it to the state.

Thanks for the suggestions, I was hoping for an easy fix but it seems it's going to take more effort than it's worth to get to the bottom of it and I have already spent probably 8 or more hours on it so far. Like a dog with a bone I just didn't want to give it up hahahaha


Zen Cart and it's community are the best!!