Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Tax Added, Not Compounded


designgroop

Recommended Posts

Hi All,

 

I've been running OSCommerce for years now, and I've touched on this issue before, but tried to avoid it. The problem is that tax rates, whether prioritised differently, or the same, are ALWAYS added together.

 

In my example, I want three Tax Zones - UK, EU & ROW (rest of World). Items shipped from me (UK) to the UK or EU should incur 17.5% VAT. ROW incurs 0%. If the UK is included in EU, it works (as 17.5% is added to NET cost). However, if I try to run EU and UK as different zones, to help separate shipping modules, then OSC adds both 17.5% tax classes together - placing 35% tax on all prices across the site (front & admin).

 

I initially thought this was a result of various contributions but I have since tested on fresh installations and the same issue appears. Additionally, it appears to have been addressed here: http://www.oscommerce.com/about/news,91 (2003) but never resolved.

 

I would really appreciate some help on this one.. It must be affecting other people.

 

Look forward to some responses..

 

Cheers.

 

R.

Link to comment
Share on other sites

I think I have cracked it. I would appreciate it if anyone else could verify this..

 

I found that the tax rates are being added, when they should be compounded according to priority. So, to correctly calculate tax in admin/categories.php, I changed the following..

 

admin>includes>functions>general.php

 

Function tep_get_tax_rate_value

 

Change from:

$tax_query = tep_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " where tax_class_id = '" . (int)$class_id . "' group by tax_priority");

 

To:

$tax_query = tep_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " where tax_class_id = '" . (int)$class_id . "' group by tax_priority limit 0,1");

 

 

I don't fully understand 'GROUP BY', however, with my tax classes, the query returns a list of the possible taxes when they have different priorities, and simply adds them together when they have the same priority. However, the 'SUM' syntax will add the former result together, when you only want the tax with the highest priority. I have corrected this by limiting the result to just one entry. For me, for now, this works.

 

Hope this helps someone else - or if I've got this completely wrong, I hope someone can correct me.

 

R.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...