[ic] Tax Popup

Russ Mann interchange-users@icdevgroup.org
Thu Jul 11 13:29:01 2002


> >     I was wondering if anybody has added to their shipping method
> > dropdown,
> > a popup (Like the state dropdown, when you select the taxable state - it
> > lets you know how much additional this will be).  I'm not looking for a
> > price in the popup(because it wouldn't work unless the zipcode was typed
> > in), just a popup to warn my customers that there will be a price
> > increase,
> > and to go back and recalculate.
> >
> >     If anyone has any information on this... it would be much
> appreciated.
> >
> > Thanks for your time
> >
> > Mark L.
>
>
> foundation, in 4.8.3 does exactly this. You need to set your taxable state
> first.
>
> Paul
>


Mark,

I modified the foundation's script because it wasn't accurate enough for me
:)

<SCRIPT>    // JavaScript Form Validation Demo    // by Paul Colton
function check_tax(form,prev_state) {
// Make sure the email field is not blank
var foundState = false;
var ch = form.state.value;
var text_to_say = "Please wait while we update your sales tax information
for "+ch+".\n";
ch = ch.toUpperCase();
[loop list="__TAXAREA__"]
if(ch == "[loop-code]") {
text_to_say += "You will be charged [currency][fly-tax
[loop-code]][/currency] sales tax\nsince you are shipping to [loop-code].";
foundState = true;
}
[/loop]
[loop list="__TAXAREA__"]
if(prev_state == "[loop-code]") {
foundState = true;
}
[/loop]
if(foundState) {
alert(text_to_say);
form.submit();
}
return foundState;
}
</SCRIPT>


I then modified the state display code to this:

[loop search="
fi=state.txt
sf=country
se=[default country US]
rf=state,name
ml=100
"
option=state]
[on-match]
<select onchange="check_tax(this.form, '[value state]')" name="state">
<option value="">--Please Select--</option>
[/on-match]
[list]
<option value="[loop-code]">[loop-pos 1]
[/list]
[on-match]</select>[/on-match]
[no-match]<input name="state" value="[value state]" size="40">[/no-match]
[/loop]

This way, they only get a warning and refresh if they switch to or from a
taxable state.  If they switch from texas to north carolina, for example, it
doesn't tell them anything because those are both not taxed for me.  If they
switch to or from Idaho, however, which is taxed for this store, they will
receive a message and a refresh.

Hope this helps,

Russell mann