close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Adding a product to cart with optional paid-for add-ons

Thread began 11/23/2009 9:22 am by jon211112 | Last modified 12/01/2009 5:18 pm by Eric Mittman | 977 views | 5 replies |

jon211112

Adding a product to cart with optional paid-for add-ons

Can you give me a pointer on how to be able to add an item to the cart but, on the product page, have a list of optional extras - some free, some paid for - which get added when the 'Add to Cart' button is clicked?


For example...

Pair of Jeans £15.00
Size: S/M/L/XL (no extra charge)
Matching Shirt: £10.00
Next day delivery: £5.00

Add to Cart


The product page will have a form containing tick boxes, dropdowns or radio buttons for the options, but one Add to Cart button which puts it all into the eCart.

Many thanks

Jon

Sign in to reply to this post

Eric Mittman

Getting this in place with just the jeans and the size will be easy enough, this is just a standard add to cart server behavior for this part.

To get the other items to add may be a little trickier, will you want to add these as items to the cart like the jeans or as extra options for the jeans? Please let me know about these details and I will help you out with whatever I can.

Sign in to reply to this post

jon211112

Thanks Eric.

Some more information.

I have a table containing all the products.

There is another table containing additional options, each record containing the record id of the product the option relates to. So some products may have no additional options, some may have quite a few (no more than ten, probably no more than five).

My page will show the product and then underneath will show all the options available for that product, some free, some costing extra.

I don't mind whether a single item is added to the cart and all the options are extra fields for that item, or whether we have one cart item per option.

But, I want a single Add to Cart which does it all in one process.

I'm really struggling with this. Because the list of options is dynamic I can't see how I can put these into the cart.

One last thing is that, if the options are costing extra, the product total needs to reflect this, or - if we are adding each option has a separate item - then the cart total needs to. Either way, so long as the product and all the options are in the cart and the cart total is correct, I'm happy.

Your thoughts would be very much appreciated.

Thanks again

Jon

Sign in to reply to this post

Eric Mittman

One way that I can imagine this being accomplished would be to have more than one add to cart on the page, one for each option set. You would first start out by just adding in these add to carts to the page, next you would update all of the add to cart's on the page for the item options to be triggered on the posted value from the select list for that option.

Finally you will update the add to cart server behaviors to get their values from this options select list, you can assume the id and for the quantity you would use the quantity from the main item. If the price for the option is based on the option id then you will need to have another recordset on the page that filters based on this value so you can get the corresponding price for that option.

Sign in to reply to this post

jon211112

Thanks Eric.

I've managed to sort it. It required rethinking the whole logic and I've now mad the add-to-cart code sit in a separate file which the product form has it's action set to and I can select whatever elements to post to it that I choose. The add-to-cart then takes all the $_POST variables, puts what's received into the cart and then redirects to the showcart page. And it works a treat.

Thanks for your help. I hope this is useful to others.

All the best

Jon

Sign in to reply to this post

Eric Mittman

That is fantastic to hear, there is a bit of flexibility within the eCart code to do many things but a lot of this is more advanced and requires some custom coding. I'm very glad to hear that you got it all worked out.

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