Notes on Taxes in osCommerce
If you don't use embedded taxes, and don't have a mix of taxable and tax-free products, and don't have a different rate of tax for shipping, please skip this section.
Mixing taxable and non-taxable products
The way taxes are handled internally in osCommerce is that the entire tax amount is stored in the cart; the tax is not broken down on an item by item basis. For this reason, tax recalculation after discounting may not work perfectly if items which attract different levels of tax are in the cart - for example, taxable and non-taxable items.Included Taxes and My Mods
This section is only relevant to osCommerce Carts which use "Display Prices with Tax" = true (in Admin > Configuration > My Store).If your shop displays prices with tax included, you should configure my discounting mods to use Include Tax = true and set Re-Calculate tax to either "Standard" or "VAT" (depending on how taxes are handled in your jurisdiction).
There was a time when my software would gross up percentage discounts for tax but not currency based discounts. I decided to change this and handle both uniformly, so now (post April 2010) if you configure one of my discount mods to use include taxes = true, your discount will be grossed up whether it is a currency value or a percentage.
Tax Descriptions
Due to the way gross-up and gross-down calculations are done for shops using embedded taxes, your tax descriptions (as shown in Admin > Locations/Taxes > Tax Rates) must be unique. This example is from Zen Cart but the osCommerce logic works the same way (although the display is different.) The customer using the setup shown below had problems because the recalculation logic couldn't tell which version ofVarav moms(Swedish for "Including VAT") should be used.
In osCommerce, to see this you would need to open each tax rate using the edit button on the right.
Alternatively you could use the SQL query:
mysql> select tax_rates_id, tax_rate, tax_description from tax_rates;This example would have a problem, since rates 4 and 5 have the same description.
+--------------+----------+-----------------+ | tax_rates_id | tax_rate | tax_description | +--------------+----------+-----------------+ | 2 | 0.00 | View | | 7 | 45.00 | Média | | 4 | 30.00 | Baixa | | 5 | 35.00 | Baixa |
Once you've fixed things, you can check your work with
mysql> select count(*) from tax_rates;then
mysql> select count(*) from (select distinct tax_description from tax_rates) as T;These numbers should be the same.
Different rates of tax for shipping
If you have taxable shipping but the tax rate is different than it is for products, you'll need to make some code changes. Firstly, be sure your descriptions for shipping taxes include an easily identifiable string such as "on shipping" (Again, this screenshot is from Zen Cart.)Then, in the discount module you use, skip over this tax when computing the updated amount of tax.
Here is a block of logic from Quantity Discounts:
switch ($this->calculate_tax) {
case 'Standard':
reset($order->info['tax_groups']);
while (list($key, $value) = each($order->info['tax_groups']))
{
if (strpos($key,"on shipping") !== false) {
continue;
}
$tax_rate = $this->get_tax_rate_from_desc($key);
if ($tax_rate > 0) {
$od_amount[$key] = $tod_amount = round((($od_amount['total'] * $tax_rate)) /100, 2) ;
$od_amount['tax'] += $tod_amount;
}
}
break;