close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Linking Multi Options To Add To Cart Button

Thread began 3/11/2010 9:53 am by SaladoGuy | Last modified 3/17/2010 5:54 pm by Eric Mittman | 1258 views | 8 replies |

SaladoGuyBeta Tester

Linking Multi Options To Add To Cart Button

I would like to build off of this post that I was posted by someone else, if that is ok.

showthread.php?t=5889&highlight=stun+gun

Here is my question that comes from the link above:

I understand setting up the the database the way you described, but how do I implement the multi options in our webpage. In other words, how do I link the the multi options to the add to cart button.

We do have the super suite from webassist. Is there a tool that came with the super suite that we can use to implement this?

I am including an attachment.
Here is the website that it will link to: product.php

I don't show it on the website yet, but the plan is to have 2 form drop downs by each diaper, so the customer can pick there size and color. And thats what we want to link to the database. In other words, a customer picks a small diaper and a green color from the drop downs next to the diaper, then the customer clicks add to cart. We want the add to cart button to save the options the customer just picked. For some reason its not working for me. Looking at the database, can you tell me what I missing?

Thanks for any help
Mark

Sign in to reply to this post

Eric Mittman

There are a couple of ways that you can use the select list to add options to the cart. You can populate the select lists from recordsets and set the value to what you would like to see in the cart. For example, if you have multiple sizes you would have a recordset on the page to select all of the sizes available for that item. You would then use this recordset to populate your size select list.

Once you have done this you need to ensure that the value of the select list is set to the name of the size. This should be all that is needed to setup the size select list. To make it add to the cart like this you will need to ensure that the select list is within the add to cart form and that you bind this select list to the size column in your cart.

If you have options that will alter the price of the item the approach will differ and will require some more recordsets to work properly. Please post back with any questions that you have about this and let us know how exactly you would like the options to work.

Sign in to reply to this post

SaladoGuyBeta Tester

Tutorial?

Thanks for the help. I do need the options to change the price. I already have the database tables setup as recommended in the thread about stun guns. I'm not real familiar with setting up recordsets. I have done it but don't really understand how it all works. Is there some online tutorial that you guys can recommend?

Sign in to reply to this post

SaladoGuyBeta Tester

Joining option name and price

Here is a link to our website product page product.php.
We are trying to link the Price drop down to the Name drop down.
Right now the Price drop down sends the correct price to the shopping cart page, but I need some text on the shopping cart page that shows what size they picked.
So I added a second drop down (Name) that adds the text I want to the shopping cart page.
The big problem with this is that you have to select the same option from each drop down in order for it to work like I want it to.
How can I eliminate the second drop down.

Thanks again for your help!

Sign in to reply to this post

Eric Mittman

I will use the size as the example option. With the size where does the price come from? Is the price of the item only based on the size, or does the size add to the price of the item? Also, are you storing the price that goes along with the size in your size table? I'm curious about this info because I want to help you come up with a strategy that you will understand and that works well for you so that you can get this implemented the way you need it to be.

If the size is stored with the price and this is the price of the item for that size then you would have a size select list with the size as the label, and the id as the value. When the user selects the size and adds the item to the cart you will have another size recordset on the page that is filtered by the size the user selected. This second size recordset is the key, if you can filter the recordset for the size that the user selected you can get back all of the other info for that record including the price to charge.

You can then make use of price that comes from this recordset directly in your add to cart server behavior along with the size itself. So this way a user makes a single size selection when adding the item to the cart and you can get back multiple values for that size including the price, so there is no need for the user to make multiple selections for the same item. This is also a more secure method that storing the price in a form element or select list, if it is in a form element of any type a crafty user could alter the code on the page before it is submitted or with javascript to alter the price of the item. If you are getting the price from a record in your db you can eliminate this possibility.

Please post back with some more info about your setup and how it is going to work and include any questions about any part that was mentioned here.

Sign in to reply to this post

SaladoGuyBeta Tester

Database option setup

The way my database is setup I have a product table with the SKU, Name, Base price, Desc. and so on. I also have a productoptions table that has a sizeID, size name and a price increment to add to the base price e.g. New Born adds $0.00, Small adds $1.50 and so on. What actually happens with my current configuration is; when a size is chosen the price in my productoptions table replaces the base price in the product table instead of being added to it.
It makes sense to have a recordset connected to my add to cart server behavior, but I don't understand how to make that work.
See attachment for Database Structure.

Thanks for your help!

Sign in to reply to this post

Eric Mittman

The trick to all of this is having the size select list in the add to cart form on the page. The user will select a size, the values should be set to the id. When the form is posted, meaning the user clicked on the add to cart button, the selected size id will be posted to the page.

You will then need to have another recordset on the page that is filtered on this posted size id. This is the key to getting it to work properly. Once you have this new recordset on the page that is filtering on the id you can then edit your add to cart server behavior. On the bindings tab in the server behavior you can select a cart column then select it corresponding value by using the lightning bolt icon to select the column from your newly filtered recordset.

I think you may be getting close with what you have. If you can post back with the page in question I can take a look to see if I can spot any issues about how it is setup.

Sign in to reply to this post

SaladoGuyBeta Tester

I think we're getting somewhere!
Here are two pages...my product page and cart page.
I have the size option dropdown values bound to the optionID, and I have the recordset you described on the cart page, but I don't know how to filter the recordset to the posted optionID.
Thanks again for the help, I really think we're getting close.

Sign in to reply to this post

Eric Mittman

You will be making this update on your product page, not on the cart page. Currently you have the productoptionID from the $sizeOptions_rs recordset set as the value of your size select list. To make it work correctly you will need to have another recordset that is almost identical to the current sizeOptions_rs recordset. The only difference is that this second recordset will be filtered on the posted optionID.

Add a new recordset and go to advanced view, in here you will have the query like this:

SELECT * FROM productoptions

You will need to update it to be like this:

SELECT * FROM productoptions
WHERE productoptionID = colname

Then just under the query view in the advanced interface you will add a new query variable, it will have settings like this:

name: colname
type: numeric
default value: -1
runtime value: $_POST['SoftDipesCart1_4_Price_Add']

This should create a new recordset for you that is filtered on the selection of the posted size select list. You can then go into your add to cart server behavior and in the bindings tab select your column and then using the lightning bolt icon select the value that will be coming from this newly defined recordset. This way you can add any details about the selected size in your add to cart server behavior.

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