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

Dropdown not adding to cart

Thread began 7/08/2009 12:47 pm by dacker1313513 | Last modified 7/09/2009 5:56 pm by Ray Borduin | 1413 views | 7 replies |

dacker1313513

Dropdown not adding to cart

New to eCart so bare with me.
I have a site where a customer can choose from a dropdown list, click on the "Add to cart" button (I used a custom image for this) for different size items.

The problem: regardless of which size the customer chooses, it always places the same item in the cart. Here is link to one of the pages so you can see what's going on.

hairMoist.php. If you try it you'll see what I mean.

I'm sure there's a way to do this I just don't have the experience.

Thanks.

Sign in to reply to this post

vela1606379889

Hi Dacker,

I'm looking to figure out the same thing. I looked at your code, specifically this part,

<div id="rtBottomContent">
<p class="RMbottom">
<select>
<option>16 oz. Hair Moisturizer</option>
<option>32 oz Hair Moisturizer</option>
<option>Gallon Hair Moisturizer</option>
<option>5 Gallon Hair Moisturizer</option>
</select>
<form name="LBI_1_ATC_7.95" method="POST" action="/Dealers/hairMoist.php">
<input type="hidden" name="LBI_1_ID_Add" value="7.95" >
<input type="hidden" name="LBI_1_Description_Add" value="16 oz. Hair Moisturizer" >
<input type="hidden" name="LBI_1_Weight_Add" value="1.1" >
<input type="hidden" name="LBI_1_Quantity_Add" value="6" >
<input type="hidden" name="LBI_1_Price_Add" value="7.95" >
<input type="image" src="images/button.jpg" align="right" border="0" value="Add to Cart" name="LBI_1_ATC">
</form>
</p>
</div>



You can see there how your add to cart button is only setup for the 16 oz. bottle. Somehow, when the user selects a different product that needs to change to reflect the change but it doesn't. I know that's probably not much help, but maybe it's a starting point for where to investigate. I'm very new to this to, so sorry I can't provide more insight.

Sign in to reply to this post

Ray BorduinWebAssist

You would probably set the option value to a key field that you could use to filter a recordset and then reference that recordset when doing the add to cart.

Sign in to reply to this post

dacker1313513

Would that look something like this:

<option value="description">16 oz. Hair Moisturizer</option>
etc.
etc.
etc.

Or am I looking at the wrong thing.

Sign in to reply to this post

Ray BorduinWebAssist

I would think something like:

<option value="1">16 oz. Hair Moisturizer</option>
<option value="2">32 oz Hair Moisturizer</option>
<option value="3">Gallon Hair Moisturizer</option>
<option value="4">5 Gallon Hair Moisturizer</option>

Then in your database you have a table of options with
ID, Name, Price

you can then filter a recordset with the submitted list value and return the associated option name and price from a single list. Then bind those fields in the cart from the recordset you have created.

Sign in to reply to this post

dacker1313513

Thanks Ray for your time. I guess I'm going to have to go back to school for this eCart program. I've tried for 6 hours today and the results are the same. Here's a look at my code.

<div id="rtBottomContent">
<p class="RMbottom">
<select>
<option value="1">16 oz. Hair Moisturizer</option>
<option value="2">32 oz Hair Moisturizer</option>
<option value="3">Gallon Hair Moisturizer</option>
<option value="4">5 Gallon Hair Moisturizer</option>
</select>
<form name="LBI_1_ATC_<?php echo $row_rsHairMoist['ID']; ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
<input type="hidden" name="LBI_1_ID_Add" value="<?php echo $row_rsHairMoist['ID']; ?>" >
<input type="hidden" name="LBI_1_Description_Add" value="<?php echo $row_rsHairMoist['Description']; ?>" >
<input type="hidden" name="LBI_1_Weight_Add" value="<?php echo $row_rsHairMoist['Weight']; ?>" >
<input type="hidden" name="LBI_1_Quantity_Add" value="<?php echo $row_rsHairMoist['Dealer_Qty']; ?>" >
<input type="hidden" name="LBI_1_Price_Add" value="<?php echo $row_rsHairMoist['Dealer_Price']; ?>" >
<input type="image" src="images/button.jpg" border="0" value="Add to Cart" name="LBI_1_ATC">
</form>
</p>
</div>

Sign in to reply to this post

Ray BorduinWebAssist

That part looks good. Now you need to create the recordset to look up the price and name based on the option value.

Sign in to reply to this post

dacker1313513

I see. The code your showing me is what the PHP pulls from the server. Never thought to look at that.
Here's how it looks in Dreamweaver:

<div id="rtBottomContent">
<p class="RMbottom">
<select>
<option>16 oz. Hair Moisturizer</option>
<option>32 oz Hair Moisturizer</option>
<option>Gallon Hair Moisturizer</option>
<option>5 Gallon Hair Moisturizer</option>
</select>
<form name="LBI_1_ATC_<?php echo $row_rsHairMoist['Dealer_Price']; ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
<input type="hidden" name="LBI_1_ID_Add" value="<?php echo $row_rsHairMoist['Dealer_Price']; ?>" >
<input type="hidden" name="LBI_1_Description_Add" value="<?php echo $row_rsHairMoist['Description']; ?>" >
<input type="hidden" name="LBI_1_Weight_Add" value="<?php echo $row_rsHairMoist['Weight']; ?>" >
<input type="hidden" name="LBI_1_Quantity_Add" value="<?php echo $row_rsHairMoist['Dealer_Qty']; ?>" >
<input type="hidden" name="LBI_1_Price_Add" value="<?php echo $row_rsHairMoist['Dealer_Price']; ?>" >
<input type="image" src="images/button.jpg" align="right" border="0" value="Add to Cart" name="LBI_1_ATC">
</form>
</p>
</div>

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...