Making Sales/State tax option click proof

Problems installing or using the NOP Design Free Shopping Cart that do not fit into one of the above categories.

Moderators: Koibito, Stefko, Randy

Making Sales/State tax option click proof

Postby xccelerant » Sat Feb 02, 2008 3:11 pm

I was wondering if it was possible to move the sales tax field to the checkout page, instead of having the user decide. This way when the user inputs their billing info, the state field is a drop down box and when they click on the state that has sales tax, there is no way to bypass it. Right now with the NopCart example site you can select Other States: even if you live in Arizona and not be charged sales tax. Has anyone tried modifying this??

I tried modifying an existing script and adding this to the header of the check out page.

<SCRIPT>
function calculate() {
if (document.CheckoutCart.b_state.options[document.calcform.State.selectedIndex].value == 'NY') {
// ADJUST YOUR TAX RATES ON THE LINE BELOW --------------------------------------------
document.CheckoutCart.tax.value = dp((document.CheckoutCart.subtotal.value) * 0.0825)
document.CheckoutCart.total.value = dp((document.CheckoutCart.subtotal.value) * 1.0825)
} else {
document.CheckoutCart.tax.value = dp((document.CheckoutCart.subtotal.value) * 0.000)
document.CheckoutCart.total.value = dp((document.CheckoutCart.subtotal.value) * 1.000)
}
</SCRIPT>

This is the dropdown to the check out page State field.

<TR><TD>State/Province: </td><td> <SELECT NAME=b_state onChange="calculate();"><OPTION VALUE=""><OPTION VALUE=AL>Alabama<OPTION VALUE=AK>Alaska<OPTION VALUE=AZ>Arizona<OPTION VALUE=AR>Arkansas<OPTION VALUE=CA>California<OPTION VALUE=CO>Colorado<OPTION VALUE=CT>Connecticut<OPTION VALUE=DE>Delaware<OPTION VALUE=DC>District Of Columbia<OPTION VALUE=FL>Florida<OPTION VALUE=GA>Georgia<OPTION VALUE=HI>Hawaii<OPTION VALUE=ID>Idaho<OPTION VALUE=IL>Illinois<OPTION VALUE=IN>Indiana<OPTION VALUE=IA>Iowa<OPTION VALUE=KS>Kansas<OPTION VALUE=KY>Kentucky<OPTION VALUE=LA>Louisiana<OPTION VALUE=ME>Maine<OPTION VALUE=MD>Maryland<OPTION VALUE=MA>Massachusetts<OPTION VALUE=MI>Michigan<OPTION VALUE=MN>Minnesota<OPTION VALUE=MS>Mississippi<OPTION VALUE=MO>Missouri<OPTION VALUE=MT>Montana<OPTION VALUE=NE>Nebraska<OPTION VALUE=NV>Nevada<OPTION VALUE=NH>New Hampshire<OPTION VALUE=NJ>New Jersey<OPTION VALUE=NM>New Mexico<OPTION VALUE=NY>New York<OPTION VALUE=NC>North Carolina<OPTION VALUE=ND>North Dakota<OPTION VALUE=OH>Ohio<OPTION VALUE=OK>Oklahoma<OPTION VALUE=OR>Oregon<OPTION VALUE=PA>Pennsylvania<OPTION VALUE=RI>Rhode Island<OPTION VALUE=SC>South Carolina<OPTION VALUE=SD>South Dakota<OPTION VALUE=TN>Tennessee<OPTION VALUE=TX>Texas<OPTION VALUE=UT>Utah<OPTION VALUE=VT>Vermont<OPTION VALUE=VA>Virginia<OPTION VALUE=WA>Washington<OPTION VALUE=WV>West Virginia<OPTION VALUE=WI>Wisconsin<OPTION VALUE=WY>Wyoming<OPTION VALUE=PR>Puerto Rico<OPTION VALUE=YT>Yukon Territory<OPTION VALUE=NW>NW Territory<OPTION VALUE=BC>British Columbia<OPTION VALUE=AB>Alberta<OPTION VALUE=SK>Saskatchewan<OPTION VALUE=MAN>Manitoba<OPTION VALUE=ON>Ontario<OPTION VALUE=QB>Quebec<OPTION VALUE=NB>New Brunswick<OPTION VALUE=PEI>Pr Edward Island<OPTION VALUE=NS>Nova Scotia</select></TD></TR>
xccelerant
WebMaster
 
Posts: 2
Joined: Sat Feb 02, 2008 2:41 am

Re: Making Sales/State tax option click proof

Postby Randy » Sat Feb 02, 2008 4:32 pm

Sounds like a good idea.

The managecart page would list the State Sales Tax for the State where the store is located.

The only change I would make is check to see if the b_state == s_state -- it is the state you are shipping to that determines the tax, not the where the customer gets the bill...

Randy
Randy
Guru
 
Posts: 1511
Joined: Tue Apr 22, 2003 12:21 pm
Location: Thunder Bay, Ontario

Re: Making Sales/State tax option click proof

Postby xccelerant » Mon Feb 04, 2008 5:15 pm

Hello Randy,

Thanks for replying. I'm surprised this hasn't already been done since it seems to be the only weak link with this cart. I just started with NOPcart so I am still figuring it out and not up on Javascript. Wheres the best spot to call the function. Right now I was thinking of doing it on the checkout page, but since the tax is already figured on the managecart can I call an existing function and compute it on the checkout page, or since it is already computed, then just have it added and recomputed when the state is selected?

You are right on what determines the tax. Thanks.
xccelerant
WebMaster
 
Posts: 2
Joined: Sat Feb 02, 2008 2:41 am


Return to Help: Cart / General

Who is online

Users browsing this forum: No registered users and 0 guests

cron