close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Discount based on options or sets from dropdown

Thread began 3/07/2009 9:30 pm by Travis250923 | Last modified 3/13/2009 10:13 am by Ray Borduin | 5512 views | 12 replies |

Travis250923

Discount based on options or sets from dropdown

What is the easiest way w/E-cart to provide discounts based on options in say a drop down menu? For example I have an auto part that comes in driver side, passenger side, or both as a set. If they select driver side or passenger side it is the same price but if the choose the set they get a $5 discount.

Sign in to reply to this post

Ray BorduinWebAssist

Are you using a database or is the page static?

Would this show as two items in the cart or one item with the price = (2*[price])-5?

There are a variety of ways this could be handled and different options are available depending on the specific development conditions you are working in and the end user experience you expect. The easiest way depends on how many of these discounts are offered and how the surrounding store works.

Sign in to reply to this post
Did this help? Tips are appreciated...

Travis250923

I'm using a database and trying to dynamically generate the options. I'm trying to get this to show as one product which is where part of the problem is coming in. I can see how to do this if they are separate items via ecart. Basically I'd look for the presence of both in the cart and apply a discount. But what if I don't want two items?

I'm running into a few other snags, unrelated to eCart, such as how to setup the database so I can associate these options with some but not all of the products. I'm looking over the sample database for the shoe store but that doesn't seem to really help me because it looks like all shoes would be given a size and a color. For example product A can be Driver side, passenger side, or both but product B has no options. Any thoughts on this?

Sign in to reply to this post

Ray BorduinWebAssist

You would eventually populate the options list with the options id. Then create your own recordset that filters based on the selected option and returns whatever information you need to dynamically change with that option... including price, name, quantity, or whatever else you want that list to control.

There are a variety of ways to do it. One way might be to have an option group table and an options table. The product table would have the option group assocated with it, and the options in that group are then associated to the group. Each product could then have unique options, or share options with other products that have the same option groups.

Sign in to reply to this post
Did this help? Tips are appreciated...

Travis250923

So I think I understand but my options recordset that I am trying to use to sort the options list is bringing all options twice. I set my database to have an ItemsOptionID colum in my Items table that matches with the ItemsOptionID column in the Options table so I can associate the two.

I then put in three options in the options table with an ItemsOptionID of 1:
-Driver Side
-Passenger Side
-Set

I then set the ItemsOptionID for two individual products to be 1. I attached screenshots of my recordset and how it displays on the test page. Here is what I used on the recordset:

SELECT *
FROM (itemoptions INNER JOIN items ON itemoptions.ItemOptionsID=items.ItemOptionsID)
WHERE itemoptions.ItemOptionsID = items.ItemOptionsID

Thanks again for the help

Sign in to reply to this post

Ray BorduinWebAssist

SELECT *
FROM (itemoptions INNER JOIN items ON itemoptions.ItemOptionsID=items.ItemOptionsID)

is all you need... the inner join is the equivalent of the where statement. If it shows twice, that is because you have two itemoptions for that ItemOptionsID, or it is showing more than one ItemID. Make sure to also filter this recordset by the item you are displaying so that you are only showing the options for that item.

Sign in to reply to this post
Did this help? Tips are appreciated...

Travis250923

it is likely more than one ItemsID as I thought the WHERE statement was filtering based on ItemID. How do I associate the options drop down with the specific item they are for? I think this is a little beyond me but you never know what you need to know until a client asks for it.

Oh and this is on the products page as created through the eCart getting started guide.

Sign in to reply to this post

Travis250923

So I was originally trying to apply these options to the product page but decided it would be better/easier to try it on the product details page because now I know the exact item I want the options for. My items recordset (rsItems) is filtered by the URL ID and if I can get my options recordset (rsOptions) to filter by the ItemOptionsID in the items recordset that would be great. I tried this:

SELECT *
FROM itemoptions
WHERE ItemOptionsID = MMColParam

MMColParam has a default value of -1 and a Runtime value of $row_rsItems['ItemOptionsID'].

When I test this I get nothing for my options.

Sign in to reply to this post

Ray BorduinWebAssist

How are you testing.... when you test it in DW, it uses the default value, so -1 would be expected to return no results.

Sign in to reply to this post
Did this help? Tips are appreciated...

Ray BorduinWebAssist

Also the runtime value you probably can't just set to a recordset field like that... unfortunately the DW code won't work like this.

Try setting it to a $_POST, $_GET, or $_SESSION value and just set the value above the recordset manually by hand coding so for example you could set the runtime value to $_GET['TEMPIDFORRS'] and add the code on top of the page:

<?php
$_GET['TEMPIDFORRS'] = $row_rsItems['ItemOptionsID'];
?>

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

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