[ic] Using IF to check [country-region]???
kevin at cursor.biz
Fri Sep 3 10:25:06 EDT 2004
interchange at tvcables.co.uk wrote:
> Here are the problems I found with salestax:-
> 1. With salestax set to "multi" in catalog.cfg, it picked up the tax value
> from the country table but would not tax the shipping. No matter what was
> entered in the TaxShipping all it would tax was the subtotal.
> 2. I assign handling charges based on subtotal, IC seems to have no
> mechanism to tax the handling charge.
For both of these, you need to make sure that the "tax" column, in
the "country" table is set up correctly. You may want a tax column
that looks like this for the UK.
default=17.5%, food=0, mv_shipping=17.5%, mv_handling=17.5%
Duplicate that for the European countries, as appropriate.
> 3. Due to point two, I decided to change the way the handling charge was
> applied by using discount instead of handling. I then found that IC did not
> calculate the tax based on the discounted subtotal, it still used the old
> subtotal for the tax calculation. There are quite a few questions in the
> archive about this, none ever seemed to have been answered so I presume it is
> a bug?
Again, this is probably just a setup/usage problem.
> 4. I tried state based tax but this is not really what I needed and was also
> difficult to get working, gave up on it.
> All prices displayed across the site as an inc VAT price, maybe even
> display both prices ex and inc VAT, would be nice to have a tick box that
> just displays everything as either ex or inc VAT based on user preference.
> My beta checkout page is now running this code:-
> [if type="data" term="country::region::[value country]" op="eq"
> compare="Europe-EC"] [assign salestax="[calc]([total-cost
> noformat=1]-[salestax noformat=1]) * 0.175 [/calc]"] [else]
> [assign salestax=0]
> This adds 17.5% to totalcost to any country that has the region set to
> Europe- EC, for anything else in that field no tax is appied.
> I am now about to modify every page and component to display an inc vat
> price using this code kindly supplied by John Beima:-
> [tmp taxin][calc][item-price] * 1.175[/calc][/tmp]
> [currency][scratch taxin][/currency]
> This is not ideal as I have so many pages/components to mod so if anyone
> has a quicker solution please let me know asap.
You could create a UserTag to do the job, and that would be more
efficient. For instance, you could create a UserTag that could be
called like this:
[price-inc-tax code="[item-code]" rate="1.175"]
That would just be a matter of copying the "code/SystemTag/price.coretag"
file (to create your own price_inc_tax.usertag) and adding a line of
code to multiply the $amount by the $rate.
You could get all clever and get the standard tax lookup routines to
work out the tax rate for you, instead of passing 1.175, or using a
config variable, but this would rely upon your users having various
checkout values set correctly, such as "country" etc. It seems as if
you rely upon that in your code anyway, so that's ok.
If you're going to hard-code the "1.175" then you need to be mindful of
the fact that not all products are subject to the same VAT rate.
Some may be zero-rated, or not subject to VAT, for instance. This
consideration depends upon the variety of items you sell, of course.
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin at cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
More information about the interchange-users