Page 1 of 1

[5.x only] Multi-Tax Modification/Hack

Posted: Wed Jun 17, 2009 7:34 pm
by Martin
This modification allows you to apply multiple taxes in version 5.x of the Interspire Shopping Cart using the tax settings you've made in the Admin Control Panel.

Original Discussion:
http://www.interspire.com/forum/showthread.php?t=13340

Limitations:
This mod/hack is provided as is, without warranty or promise of support. I'll do what I can to help but it is only intended as an interim measure until Interspire resolve their marketing spiel and relate it to reality.


Applying the mod/hack:
Read the attached MOD file and apply the edits to the three files indicated,
Make sure you backup these files BEFORE you edit them
If you hit problems, restore the original three files.

Tip: Use a suitably competent editing tool like Notepad++ or SciTE to complete the editing. DO NOT use Notepad or WordPad because they are quite simply cr*p tools and you will be laughed at if you even try! Yes, that bad!


Using the mod/hack:
The key to this hack is that it uses the existing Tax settings you setup in your Store Admin Control Panel under "Tax Settings".

IMPORTANT Tip: Do not give any two taxes the same "Tax Name"!

eg: For Ontario, Canada, (assuming your store is in Ontario)
  1. Create a tax rule for "GST" and set the rate to 5% then save.
    This is the federal Canadian General Sales Tax that is applied to all provinces in Canada
  2. Create a new tax rule for "PST (ON)" and set this to 8% then save.
    This is the Provincial Sales Tax which is applied to all Ontario residents.
Your store will now set a single tax rate of 5% to any Canadian orders for customers in Alberta, BC, etc... but for anyone inside Ontario the store will set the federal GST and also the PST for Ontario as well.

These will appear in the customers order summary as seperate lines in their order, with a total compiling the two.


The Technical Bit:
All this hack does is use a little code cunning to collate all the relevant taxes and apply them to your customers orders. In terms of data stored it will still store the full tax rate as a single figure (not seperately) and the only indication of more than one tax being applied is in the ordtaxname field which compiles the tax names into a single value (eg: "GST + PST (ON)").

It's not overly clever and there are no fail safes built in but it does provide you with a clearer idea of what taxes have been applied so you can work back.

Will Upgrades Break Data?
YES... Future upgrades of Interspire shopping cart code will not break your shopping cart BUT if you don't re-apply the code you will find that your tax rules are not being applied properly.

The standard Interspire code applies only one tax rule in this order:
  • Province/State tax rule?
    • Yes - Apply this rule and stop
    • No - Continue
  • Country rule?
    • Yes - Apply this rule and stop
    • No - Continue
  • Global rule?
    • Yes - Apply this rule and stop
    • No - No tax and stop
I will try to keep up to date on changes but see below for my general thoughts on where Interspire should be on top of this.


Why Bother?
The simple reason for this was that an Interspire customer wanted to be able to show more clearly what taxes had been applied where, and to enable the customer to have a reference as well. The Interspire marketing blurb says that the cart will do this... Unfortunately they obviously got a bit carried away with their blurb... It does not have this functionality.

So, my hack achieves the necessary info just but frankly this is a feature that requires additional data fields in the order table (or even a seperate table to JOIN on orders) and that's Interspires job.

Trying to complete a proper, fully featured modification would have required a lot more work and probably would have been broken in the next Interspire update anyway.

So, in summary, I did this because I could figure out enough to fulfill the general requirement and to highlight the need for Interspire to deal with this properly.


Found it Useful?
If you find it useful, please feel free to contribute to info[AT]snailsource.com (via paypal) or, if you prefer make a donation to the Red Cross/Red Crescent. Alternatively, just say thankyou... it all helps.

Re: [5.x only] Multi-Tax Modification/Hack

Posted: Tue Oct 06, 2009 10:54 pm
by Martin
Hack code added for download...