Custom Order API

General ShopSite user discussion
Post Reply
Brett
Posts: 17
Joined: Fri Jan 16, 2009 11:16 am

Custom Order API

Post by Brett »

Is it possible to pass data into the shopping cart and retrieve it with the custom order API?
Jim
Site Admin
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Post by Jim »

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.
loren_d_c
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere
Contact:

Post by loren_d_c »

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
Brett
Posts: 17
Joined: Fri Jan 16, 2009 11:16 am

Post by Brett »

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

Post by Brett »

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.
Jim
Site Admin
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Post by Jim »

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).
Brett
Posts: 17
Joined: Fri Jan 16, 2009 11:16 am

Post by Brett »

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.
loren_d_c
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere
Contact:

Post by loren_d_c »

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
Brett
Posts: 17
Joined: Fri Jan 16, 2009 11:16 am

Post by Brett »

Finally got it working. Thanks alot!
Post Reply