close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Static Item with four options

Thread began 2/24/2014 2:31 pm by Rick | Last modified 2/25/2014 4:31 pm by Jason Byrnes | 389 views | 7 replies |

Rick

Static Item with four options

I have a static item with four price options which is getting to the cart fine by a menu list. I need the cart to reflect the description that reflects the price. Is there a way to send the text of the option selected into the description field?

<form name="eCart1_1_ATC_0" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
<input type="hidden" name="eCart1_1_ID_Add" value="0" >
<input type="text" name="eCart1_1_Quantity_Add" value="1" size="4" >
<select name="eCart1_1_Price_Add">
<option value="Select Option" selected>Select Option</option>
<option value="225.00">1 Child 1 Adult</option>
<option value="180.00">1 Child 1 Adult MEMBER</option>
<option value="120.00">1 Child </option>
<option value="100.00">1 Child MEMBER</option>
</select>
<input type="submit" class="eC_FormButton" value="Add to Cart" name="eCart1_1_ATC">
</form>

Sign in to reply to this post

Jason ByrnesWebAssist

in the add to cart button behavior, set the description to be updatable from a hidden field.


then add an onchange event to the price select list to populate the description hidden field using the syntax:

onChange="document.<formName>.<hiddenElementName>.value = document.<formName>.<listName>[document.<formName>.<listName>.selectedIndex].text"


where:
<formName> is the name of the form (or in your case eCart1_1_ATC_0
<hiddenElementName> is the name of the description hidden element
<listName> is the name of the price select list ( or in this case eCart1_1_Price_Add)

Sign in to reply to this post

Rick

fast reply! because I'm primarily a designer, here comes dumb question #1...

where exactly does the onChange code go?

Sign in to reply to this post

Jason ByrnesWebAssist

in the select list:

<select name="eCart1_1_Price_Add" onChange="document.<formName>.<hiddenElementName>.value = document.<formName>.<listName>[document.<formName>.<listName>.selectedIndex].text">

Sign in to reply to this post

Rick

yea. that's where I put it initially. nothing going to the cart now.

<form name="eCart1_1_ATC_01" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
<input type="hidden" name="eCart1_1_ID_Add" value="01" >
<input type="hidden" name="eCart1_1_Description_Add" value="" >
<input type="text" name="eCart1_1_Quantity_Add" value="1" size="4" >
<select name="eCart1_1_Price_Add" onChange="document.<eCart1_1_ATC_01>.<eCart1_1_Description_Add>.value=document.<eCart1_1_ATC_01>.<eCart1_1_Price_Add>[document.<eCart1_1_ATC_01>.<eCart1_1_Price_Add>.selectedIndex].text">
<option value="Select" selected>Select</option>
<option value="225.00">1 Child 1 Adult</option>
<option value="180.00">1 Child 1 Adult MEMBER</option>
<option value="120.00">1 Child</option>
<option value="100.00">1 Child MEMBER</option>
</select>
<input type="submit" class="eC_FormButton" value="Add to Cart" name="eCart1_1_ATC">
</form>

Sign in to reply to this post

Jason ByrnesWebAssist

you dont include the < and > tags in the javascript code, I onlyt used them to denote variable values.

onChange="document.<eCart1_1_ATC_01>.<eCart1_1_Description_Add>.value=document.<eCart1_1_ATC_01>.<eCart1_1_Price_Add>[document.<eCart1_1_ATC_01>.<eCart1_1_Price_Add>.selectedIndex].text"

should be:
onChange="document.eCart1_1_ATC_01.eCart1_1_Description_Add.value=document.eCart1_1_ATC_01.eCart1_1_Price_Add[document.eCart1_1_ATC_01.eCart1_1_Price_Add.selectedIndex].text"

Sign in to reply to this post

Rick

thanks Jason. that worked. Now... how to get the description that is in the shopping cart to also display at PayPal?

current results show:

Ceramics on the Wheel $260.00
Item number: 25
Item price: $260.00
Quantity: 1

I don't need the item number listed. maybe swap out the item number for the description that was generated in the cart?

Sign in to reply to this post

Jason ByrnesWebAssist

no, the item number is mandatory

you would need to concatenate the Decription on the name that is passed to paypal, if you are using eCart 6 and express checkout, look for code similar to this on the confirm page:

$WA_PP_ECO_Do_itemized[0][$nextIndex] = "Name" . strval($cartIndex+1) . "";
$WA_PP_ECO_Do_itemized[1][$nextIndex] = "".$cartName->DisplayInfo("Name") ."";

where cartName is the name of the ecart object

change that to:
$WA_PP_ECO_Do_itemized[0][$nextIndex] = "Name" . strval($cartIndex+1) . "";
$WA_PP_ECO_Do_itemized[1][$nextIndex] = "".$cartName->DisplayInfo("Name") ." ".$cartName->DisplayInfo("Description") ."";

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...