Error Trapping at Checkout?

General ShopSite user discussion

Error Trapping at Checkout?

Postby gentlemans01 » Thu Dec 04, 2008 12:54 pm

Hi all

As noted in another thread, we're having trouble with customers putting through orders with obvious errors on them.

Specifically, they're choosing a shipping mode that is not available to their address.

Shopsite has some built in error trapping (i.e. incomplete product options, etc.,) that flashes a warning up before the customer can check out. These don't cover our needs. Has anyone had any luck with using custom javascript or CGI rules to trap errors based on the content of the checkout page?

1) is there any way to add custom cgi code to the checkout error trapping routine? if so, can someone advise where the hook is for this?

2) if not that, are there any custom template tags for:
-- shipping address country
-- shipping method?


I couldn't see custom template tags to pull just those values out, but probably overlooked something.

We could perhaps use javascript to make the checkout now button available only when all the tests pass..

I'd also be interested in other methods people have used for this same type of problem.

Thanks in advance,
Chris
Chris
https://www.historicalemporium.com
gentlemans01
 
Posts: 40
Joined: Sun Aug 27, 2006 11:32 pm

Postby Jim » Thu Dec 04, 2008 1:20 pm

You can add your own javascript to the build in ShopSite checkit function by going to Commerce Setup > Order System > Shopping Cart/ Checkout/ Confirmation and putting it in the field "Javascript added at start of
built-in CheckIt function:"

The javascript variables available in the cart screens are documented on
http://www.shopsite.com/help/10.0/en-US ... ables.html
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby gentlemans01 » Thu Dec 04, 2008 2:04 pm

Hi Jim

Thanks for the prompt reply.

I kept digging after I posted, and did find the list of javascript variables. However, it looked to me like the ones needed for this validation were only available at the Thank You screen:

... ss_shippingstr
The shipping method selected. Only on the Thank You screen.

... ss_shipcountry
The shipping country. Only on the Thank You screen.

You also suggest adding javascript to the built-in "CheckIt" function.

To use the above variables, the values of the above variables would need to be available BEFORE the customer arrives at the thankyou screen, or by the time the check could be performed the order would have already gone through.

Or am I misunderstanding the "only on the Thank You screen" limitation?

I'd love to pursue this line of thought, as it seems like the right approach, but don't want to start a developer on it if the variables aren't there.

Please advise.

Thanks,
Chris
https://www.historicalemporium.com
gentlemans01
 
Posts: 40
Joined: Sun Aug 27, 2006 11:32 pm

Postby loren_d_c » Thu Dec 04, 2008 2:25 pm

Yes, the ss_shippingstr and ss_shipcountry are only available on the thankyou screen (completed orders) showing what the shopper selected for those values on previous screens.

However, the Shopping Cart JavaScript Variables are not the only things that your custom JavaScript can access, JavaScript can also access (and change, if necessary) the values of form fields when the form is submitted. For example, if there was a form field on the checkout page with the 'name' value of 'Zip', then in JavaScript the value submitted in this field can be accessed by something like document.billing.Zip.value. On the initial cart screen, where the shipping and tax are selected, the form name is 'order', so that would be something like document.order.Zip.value.

-Loren
loren_d_c
 
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Postby Jim » Thu Dec 04, 2008 2:29 pm

View the source of the shopping cart screen and you can see the ss_... javascript variables that are listed there, provided your custom template included the tag to display them. If you look through the script itself you will see a var country, var shipping, etc that are reading the contents of fields in the form. These could also be used in your script.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby gentlemans01 » Thu Dec 04, 2008 3:52 pm

Excellent; thanks Jim and Loren for the cogent and helpful replies!

It looks like the javascript variables I'm after are one in the order page:
document.order.shipoptmenu.value

and another in the billing page:
document.billing.ShipCountry or document.billing.Country, I think it's the first one.

I'll get with our developer and see what we can figure out. I'll post results, and thanks again for all the good leads!

Regards,
Chris
https://www.historicalemporium.com
gentlemans01
 
Posts: 40
Joined: Sun Aug 27, 2006 11:32 pm


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot] and 111 guests