[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] No check_tax with new state_select widget


On 9/18/07, Josh Lavin <suppressed> wrote:
> When using the new state_select widget to build the list of states on
> Checkout, I've noticed that the check_tax routine to pop-up the
> amount of tax is not included.
>
> This code:
>    [display name=state type=state_select value="[value state]"]
> offers no way to run "onChange=check_tax(this.form)", as did the old
> stuff.
>
> I have hacked the country_select.widget on line 227 to include
> check_tax:
>
> - var str = '<select name="$svar_in" onChange="$v_formv.$svar.value =
> this.value">';
> + var str = '<select name="$svar_in" onChange="$v_formv.$svar.value =
> this.value;check_tax(this.form)">';
>
> But, the pop-up now appears when the either the shipping or billing
> state is one of the taxed ones.
>
> Anybody have any ideas on how to get check_tax to run only with the
> shipping state, with or without a hack?
>
> Thanks,
> --
> Josh
> Kingdom Design   http://www.kingdomdesign.com/
>
Josh -

I did something similar.  Instead of a pop-up, I just submit the form
so the shipping and tax are updated.

I hacked it just like you, but I passed in two parameters --
country_submit_form
state_submit_form

[display name=country type=country_select2 value="[value country]"
country_submit_form=1 state_submit_form=1]

So, I can set to 1 or 0 to submit or not submit on either a state
change or a country change.

Around line 192:
my $state_js = "";
if ($opt->{state_submit_form}) {
	$state_js = "$v_formv.submit();"
}

Then, the same place you changed yours:
var str = '<select name="$svar_in" onChange="$v_formv.$svar.value =
this.value;$state_js">';

(I then do the same thing for the country).

I've been meaning to revisit this and clean it up, try to generalize
it... just haven't had the time yet!

Dan Bergan
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.