Print Page | Close Window

Add item behind

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=4393
Printed Date: 13-July-2025 at 4:35am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Add item behind
Posted By: SharpDataInc
Subject: Add item behind
Date 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



Replies:
Posted By: SharpDataInc
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net