Simple Javascript to look at ss_ variables - wont work, arg!

General ShopSite user discussion

Simple Javascript to look at ss_ variables - wont work, arg!

Postby hunter » Thu Jan 07, 2010 10:05 am

OK, Im no genius but this should be easy; here is the code in my custom cart (which is just a copy of modern-sc.sst).

<div id="headlinks">

<script type="text/javascript" language="JavaScript">
document.write("here " + ss_ordernum);
</script>

If I hardcode a value for x (like x-5), it works great...shows up in the header links. ANY reference to an ss_ variable yields nothing.

WHAT AM I DOING WRONG? :(

btw, I am using the Manager version, not Pro. Is this the problem?

Ken
hunter
 
Posts: 6
Joined: Wed Jan 06, 2010 12:48 pm
Location: USA

Postby loren_d_c » Thu Jan 07, 2010 10:20 am

What version NUMBER of ShopSite Manager are you using, and what shopping cart screen is your JavaScript on?

ShopSite Manager has only had JavaScript variables available since v8.1, and only 3 of them (ss_ordernum, ss_ordertotal, ss_subtotal), and these are only available on the Thank You screen. See the Manager doc at:

http://www.shopsite.com/help/10.0/en-US/sc/mgr/cart.variables.html

Even in ShopSite Pro the ss_ordernum variable will only be on the Thank You screen, simply because the order number is not reserved for the order until the order is complete.

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

Postby hunter » Thu Jan 07, 2010 10:28 am

Shopesite v10 is what I am using.

What I really want access to the the ss_sku array so I can add some logic in the body of my cart to handle some conditional cases...

for example is I see a sku coming into the cart with a CNN_ as a preamble I would like to pre-fill or change some cart selections. An example might be to hide the Payment selector with some automated billing info for a customer who has prearranged open PO's with us.

Since I can't have more than one cart, I am trying to make cart changes based on items in the ss_sku array.

Ken
hunter
 
Posts: 6
Joined: Wed Jan 06, 2010 12:48 pm
Location: USA

Postby hunter » Thu Jan 07, 2010 10:32 am

At the top of the help screen titled "Shopping Cart JavaScript Variables" it states:
(http://www.shopsite.com/help/10.0/en-US ... ables.html)

"All information about products in the shopping cart is available in the form of JavaScript variables in the <head> section of all shopping cart pages. The billing and shipping addresses are also available as JavaScript variables on the Thank You screen. You can add JavaScript code to the built-in validation code, or call custom scripts on other parts of the screens."


The variables I want access to are listed in the Pre-Poduct Variables section which should be avail before the Thank You screen, I think. This should include the ss_sku[] array etc.

Am I reading this wrong?
Ken
hunter
 
Posts: 6
Joined: Wed Jan 06, 2010 12:48 pm
Location: USA

Postby loren_d_c » Thu Jan 07, 2010 11:32 am

You are reading it wrong in the sense that the documentation you are looking at is for ShopSite Pro, not ShopSite Manager. The ShopSite Manager doc is where I listed it previously:

http://www.shopsite.com/help/10.0/en-US/sc/mgr/cart.variables.html

If you want to use the product arrays, then you will need to upgrade to a ShopSite Pro license.

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

Postby hunter » Thu Jan 07, 2010 11:46 am

Ah, thought that might be biting me...

Well I guess I can do some DOM surfing using the cart_sku.innerHTML data to find out and then go make changes....such a rough way to do it though...very reactionary.

or upgrade...

Thanks
Ken
hunter
 
Posts: 6
Joined: Wed Jan 06, 2010 12:48 pm
Location: USA


Return to User Forum

Who is online

Users browsing this forum: No registered users and 68 guests

cron