[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: A solution (was Re: how to calculate shipping tax?)
At 12:34 PM 6/17/99 , Kyle Hayes wrote:
>****** message to minivend-users from Kyle Hayes <kyle540@quicknet.net>
******
>
>
>The problem:
>
>I was trying to figure out how to have sales tax applied when the buyer
>was in California in the US, and not elsewhere in the world that might
>have a state or region name abreviated to CA. The standard sales tax
>mechanism does not seem to allow triggering on two values instead of one.
>
>My solution was to manually make one quantity on the checkout page with a
>little perl script and then use that new quantity as the lookup key in the
>salestax.asc database.
>
>A Solution:
>
>1. create a hidden field on the page (I called it 'sales_tax_region').
>
>2. with a little perl script, fill in the value of that field. This is
>what my code looks like:
>
><INPUT .... NAME="sales_tax_region" VALUE="[value sales_tax_region]">
>
>[perl values]
> $Safe{values}{sales_tax_region} =
> $Safe{values}{country} . "_" .
> $Safe{values}{state};
>
> return "";
>[/perl]
>
>3. in the catalog.cfg file, change SalesTax to use this new field:
>
>...
>SalesTax sales_tax_region
>...
>
>4. in salestax.asc, I have the following:
>
>default 0
>US_CA 0.0825
>
>5. fire it off!
Cool.
>
>The one problem I found was that if the person reached the checkout page
>and the default country was already the correct country, they wouldn't
>change it and thus would not cause sales_tax_region to be filled. My
>thought on this is to default the country selection to a country that
>doesn't exist (e.g. "Choose a Country"). That will force the user to
>change the country and thus cause the field to be filled. That will still
>not catch all cases, but it should get closer. Any thoughts on how to
>make this happen?
>
>My worry is that someone will choose the US. That will force a page
>submit and will reload everything. However, if they haven't filled in the
>state field yet, the sales_tax_region variable will not have the state in
>it. If they hit submit after filling in the state, there is no recalc
>done on the page as far as I know. Any help to get this problem solved
>would be appreciated.
Really, it seems like you would have the best luck by using a multiple
page check out. It would take a little more effort, but would probably
make complex situations like this one a bit easier to deal with. Just my $.02
>
>Best,
>Kyle
Ryan Hertz tel 520-645-3812
Webmaster tel 800-645-BAIT
Advertising Director fax 520-645-2588
Gary Yamamoto Custom Baits, Inc. http://www.yamamoto.baits.com