ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - Add item behind
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Add item behind

 Post Reply Post Reply
Author
Message
SharpDataInc View Drop Down
Groupie
Groupie


Joined: 10-August-2010
Location: Chicago
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote SharpDataInc Quote  Post ReplyReply Direct Link To This Post Topic: Add item behind
    Posted: 27-March-2011 at 12:48am
version 3.51
The merchant has 1 item on a page with 3 radio buttons for small / med / large, and they all have a different ID numbers and SKU. I want to add a completely different item to the cart when they add any one of these items. So I tried the code for adding multiple items and it seems the ID numbers (in the ex) match the input names. Your example shows 1 product being added "behind the scenes", but how do you do say 3 or 4? When the radio button is clicked it returns a number to the input as its value from script. But then it will no work if it returns something different than the "name" of the input. So...
 
<input name="idProduct1" type="hidden" value="431">
<input name="QtyM431" type="text" value="1">
 
If my value of 431 (small)  is now 432 (med), it will not work because of the QtyM431 name. Can someone explain how this is suppose to work if my values get changed? Or maybe I am not understanding it.
 
Thanks
SDI
Sharp Data Incorporated
Back to Top
SharpDataInc View Drop Down
Groupie
Groupie


Joined: 10-August-2010
Location: Chicago
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote SharpDataInc Quote  Post ReplyReply Direct Link To This Post Posted: 27-March-2011 at 11:18am
Okay, I pretty much figured it out. I used some scripting to go through the radio controls to see which one is checked and set that to the correct input value.

<!-- small-->               
<input name="idProduct1" type="hidden" value="2160">
<input name="QtyM2160" id="myProduct" type="hidden" value="1">
<input name="BTOTOTAL1" type="hidden" value="185">

<!-- medium -->               
<input name="idProduct2" type="hidden" value="2161">
<input name="QtyM2161" id="myProduct2" type="hidden" value="0">
<input name="BTOTOTAL2" type="hidden" value="185">

<!-- large -->               
<input name="idProduct3" type="hidden" value="2162">
<input name="QtyM2162" id="myProduct3" type="hidden" value="0">
<input name="BTOTOTAL3" type="hidden" value="185">

<!-- item to be added for a penny -->
<input name="idProduct4" type="hidden" value="2245">               
<input name="QtyM2245" type="hidden" value="1">
<input name="BTOTOTAL4" type="hidden" value="0.01">

The default is the small (its checked already), then if the user selects a different size the script assigns the 'true/false' to the correct input by the getElementByID code that the "onclick" for that particular radio button. It adds the item to be added for a penny for any size (as a promo), behind the scenes. Now, when should I use the pcCartArray, to see if the "promo" item was added already, before adding it? Should code be in the viewCart.asp module? I dont want to add it more than onces, AND it should be removed if none of the promo parent products are in the cart, ie - the small/med/large items.
 
On another note, where is the session.timeout intiated and in which asp docs is it in. I read the documentation on it, but it doesnt specify which files this setting can be changed.
 
Individual Page. The amount of time after which a session is cleared can be altered by using the “session.timeout” variable. A proficient ASP programmer can help you edit this setting. Several pages in ProductCart use a higher session timeout setting by default (e.g. importing and exporting features).
 
Thanks!
SDI
Sharp Data Incorporated
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.