Guest Posted May 17, 2004 Posted May 17, 2004 I have installed the County Sales Tax Mod http://www.oscommerce.com/community/contributions,1660/ BUT! it seems that oscommerce is rounding the tax down instead of up.. here is what my cart says.. Sub-Total: $274.75Table Rate (Best Way): $27.48 Philadelphia Co. Sales Tax 7%: $21.15 <-- County Sales Tax Mod Total: $323.38 nowthe sub total adds up correctly, and the shipping module is working correctly, but it should calculate the tax on $302.23 sub-total + Shipping Rate. so far so good.. now we calculate 7% sales tax on top of this... 302.23 * .07 = 21.1561 now that should round up to 21.16 not down to 21.15 currently the total is calculated to 323.38 but it should be 323.39 I know this is only a penny, but a penny is a penny. I have looked through anything i could find attributed to this, but i can not find where oscommerce does its rounding. Initially i thought it was the MOD i installed but after close review of its code, it is building and rounding its numbers from inside oscommerce, now, the problem becomes... where does it round the tax?? or does it not even round the tax and in turn just truncates it to 2 decimal places? TIA Mike Quote
Guest Posted June 3, 2004 Posted June 3, 2004 i believe the tax 'places' just gets trunctuated to two (or however many you set it to - which you can change), because it's handled in cells of your database. One may be able to make a small script to take the numbers, and before passing them into the database's data holding cell, 'rould-up' and simply pass the 2 rounded-up numbers to the DB. But unfortunately i'm not the one to ask 'how' because i wouldn't know how to do it. Simply dont know php. sorry Quote
Acheron Posted June 8, 2004 Posted June 8, 2004 Mike- Check the PHP manual in regards to this. There is some raw PHP you can use to round if need be. osC rounds up at some point but obviously not the entire way. hehe This annoys me a bit as well so lmk if you get anywhere with this. Quote
martinmacca Posted June 23, 2004 Posted June 23, 2004 My cart is doing a similar thing with the prices being rounded up incorrectly when using product attributes. Did you find a fix ? Quote
kartooz Posted July 10, 2004 Posted July 10, 2004 Exact problem. but in my case let say it the total is $ 2.74// but the customer is getting charger $3 please help me before i get in truoble. www.gearfortech.com Quote
martinmacca Posted July 10, 2004 Posted July 10, 2004 I hired a coder to fix my problem, cost me $50 but could of got it cheaper. This is what i was told my problem was: I think I discovered the problem. Here is the offending line: display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity'] [Line 163 of shopping_cart.php] If you look at the code it calculates the price by taking the product price and multiplying in by the tax rate. In the example you provided the (product and options) values passed to the display_price routine above are 688, 17.5, 1 or 688 * .175 * 1 which equals 808.40. The sub-totals displayed on the left and bottom are calculated by adding up the product price and option price from the shopping page. These prices have the taxes already calculated in. As a result there will sometimes be rounding errors. Ie. Product price 799 Option 1 3.53 Option 2 5.88 Total 808.41 Option 1 price is calculated as 3.00 * .175 = 3.525 rounded up to 3.53 Option 2 price is calculated as 5.00 * .175 = 5.875 rounded up to 5.88 But... 799 + 3.53 + 5.88 = 808.41 799 + 3.525 + 5.875 = 809.40 So the rounding accounts for the penny difference. Quote
Harald Ponce de Leon Posted July 11, 2004 Posted July 11, 2004 Can an example case be provided where the rounding is not correct? For this the following is needed: * Exact price of products involved (to 4 decimal places (the value in the database)) * Exact price of product attributes involved (also to 4 decimal places) * Tax rate value (to 4 decimal places) * Are the tax rates added to the products price or only shown on the checkout page? (Administration Tool -> Configuration -> My Store -> Display Prices With Tax) * A flat fee shipping rate value (optional) Quote , osCommerce
kartooz Posted July 25, 2004 Posted July 25, 2004 I figure the problem. it is simply changes have to made in your configuration. do not change any code for decimal problems. contact me i will help u guys out Quote
mark Posted September 13, 2004 Posted September 13, 2004 I have the same problem. Its truncating the taxes. ie. Cart is showing Sub-Total: $59.99 Zone Rates (Shipping to CA : 1 lb(s)): $4.00 PST + GST: $9.33 (15%) Total: $73.32 But taxes should $9.59 I tried fooling around with the new tax/decimal field in the admin-> COnfiguration - to no avail. I cant even logicaly make out where it reduces the tax by 26 cents! Any help would be apreicated. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.