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

shopping options with different price based on options

Thread began 3/11/2010 5:16 pm by tim299030 | Last modified 3/12/2010 3:47 pm by tim299030 | 901 views | 4 replies |

tim299030

shopping options with different price based on options

I have a cart for a coffee roaster that I'm modifying to give the shopper a couple of different options. The options are:

Ground or Whole Bean
I created a table called Grind with ID 1 = Ground and ID 2 = Whole Bean

Size - Two sizes of bags -- 4oz and 12oz
I created a table called Size with ID 1= .75 (3/4 of a lb) and ID 2= .25 (1/4 of a lb)

So for each product the customer would choose:

a) ground or whole bean
b) 4oz or 12oz bag

Right now I have a separate record for each size so when the customer comes to the site they see the same product listed twice -- the only difference being the size and price. My customer wants there to be just one product listed and have the ability to select the size with a select list. If I create the record set for size, how would I handle the different price for the 4oz and 12oz bag?


I'm using the Recipe 6 "Database-driven Shopping Options" which uses the shoe store with Men's and Women's sizes and different colors. I think it's more complex than what I'm trying to do but I'm getting hung up when it says to copy and paste the snippet. It doesn't seem like I need to do that -- but I'm not sure and so I don't want to go further with that.

So I guess my fundamental questions are:

Don't I just need the two record sets and thus two select lists (one for "size" and one for "grind")?

And how do I get the correct price associated with the appropriate size?

Sign in to reply to this post

Jason ByrnesWebAssist

where your options are so limited, I dont think I would use a recordset. I would just enter the 2 sizes and the two grinds manually as static items in the list.

For the price, there are a couple of way to go. Probably the simplest is to create a new column in your eCaret object that you can send the large bag price to. you could call it "lgPrice" in the add to cart button, pass the 1/4 pund bag price to the Price column and the amount extra to charge for the 3/4 pound bag to the lgPrice column.

so if a 1/4 pund bag is $4 and the 3/4 pund bag is $9, you will pass 4 to the price column and 5 to the lgPrice column

Next, on the eCart object tag, create a calculation that will be used to determine the price to apply the product, call it realPrice. If the size that is passed for the 3/4 pound bag is "3/4 of a lb" the calculation will look like:
(([size] = "3/4 of a lb")?[Price] + [lgPrice]:[Price])

you then have to modify the total Price calculation:
[Price] * [Quantity]


to:
(([size] = "3/4 of a lb")?[Price] + [lgPrice]:[Price]) * [Quantity]


You will want to change the cart display to use the realPrice column in place of the price column, and change the checkout code top pass the realPrice to the gateway in place of the price.

Sign in to reply to this post

tim299030

I'm not sure I'm following you.

(In your calculation, is there supposed to be a "?")

So if I used your calculation for the large bag, would this be correct?

(([1] = ".75")?[4] + [5]:[9]) * [Quantity] -- my interpretation of your calculation

(([size] = "3/4 of a lb")?[Price] + [lgPrice]:[Price]) * [Quantity] -- your calculation


But if I do all that, why is it not possible to just have two price fields for each product (LgPrice and SmPrice)? Is it because the calculation uses both fields regardless if the person chooses small or large?

Also, how should I handle the different weights?

Sign in to reply to this post

Jason ByrnesWebAssist

the calculation is a ternary expression that takes an argument and has a condition for true or false. The end of the argument is the question mark, the true and false conditions are separated by the colon.,the syntax simplified is:
((argument)?if true:if false)


The calculation is supposed to use your cart column names, not the actual values. if the value being passed by the size list is one for the 3/4 pound bag, then the calculation should be:
(([size] = "1")?[Price] + [lgPrice]:[Price])

this would interprate to:
(("1" = "1")?4 + 5:4)


this is saying: if the Size is 1, use Price + lgPrice, else use just price

you could certainly have the small full price in the price column and the large price in the lgPrice column and change the calculation to:
(([size] = "1")?[lgPrice]:[Price])



for the weight, you will need to do something similar, create a lgWeight column and modify the total weight calculation:
(([size] = "1")?[lgWeight]:[Weight]) * [Quantity]

Sign in to reply to this post

tim299030

Excellent explanation. Thank you, Jason.

I think I understand. I'll let you know if I don't.

Tim

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