Custom Order API

General ShopSite user discussion

Custom Order API

Postby Brett » Fri Jan 16, 2009 11:23 am

Is it possible to pass data into the shopping cart and retrieve it with the custom order API?
Brett
 
Posts: 17
Joined: Fri Jan 16, 2009 11:16 am

Postby Jim » Fri Jan 16, 2009 12:48 pm

What type of information do you mean? A list of the fields that are available to Order API can be found at
http://shopsite.com/help/10.0/en-US/sc/ ... .spec.html

If the info isn't in one of those fields then it isn't possible to pass it.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby loren_d_c » Fri Jan 16, 2009 1:03 pm

If it's arbitrary info that you don't need to actually be in the shopping cart or in the resulting order, then you could set it in a cookie before the shopper gets to the cart, and then from your custom Order API you can read the cookies in the shopper's browser (assuming the cookie is set from the same domain as the secure shopping cart URL), and capture the information that way.

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

Postby Brett » Tue Jan 20, 2009 1:25 pm

Thanks for the responses. I'm passing a text field and the custom order api is on a different domain. It looks like I'll have to use a different method.
Brett
 
Posts: 17
Joined: Fri Jan 16, 2009 11:16 am

Postby Brett » Tue Jan 20, 2009 3:46 pm

I decided to set up a "Customer Text Entry Box" field for the specific product. I noticed there were "Special Rules" to verify for the drop-down options. Is it possible to do this for the text entry box as well? I need a field that will require a customer to enter a certain amount of characters and will error out if the field is empty.
Brett
 
Posts: 17
Joined: Fri Jan 16, 2009 11:16 am

Postby Jim » Tue Jan 20, 2009 4:26 pm

There is nothing built in to the text field that would require data input. You could probably write some javascript that would check for content and not let them proceed if it is blank. But that would require the shopper to have javascript enabled and that you know javascript well (or someone that knows javascript well).
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby Brett » Thu Jan 22, 2009 11:02 am

I've found how to edit the CheckIt js function, which is what I was looking for. The problem I'm running into now is I need a way to access the "Customer Text Entry Box" data for verification. There is a js variable for the drop-down order options, but from what I can see there is not a variable for the text box. Any suggestions? Thanks for the help.
Brett
 
Posts: 17
Joined: Fri Jan 16, 2009 11:16 am

Postby loren_d_c » Thu Jan 22, 2009 11:38 am

Brett,

In JavaScript any form field value can be accessed in the variable format:

document.[form_name].[field_name].value

So for example if you are on the Checkout screen where the form name is 'billing' and via your JavaScript you are checking the value of a Custom Checkout Field whose form field name is field01, then it would be:

document.billing.field01.value

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

Postby Brett » Thu Jan 22, 2009 2:40 pm

Finally got it working. Thanks alot!
Brett
 
Posts: 17
Joined: Fri Jan 16, 2009 11:16 am


Return to User Forum

Who is online

Users browsing this forum: No registered users and 103 guests