View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Specific pricing based on quantity entered

Thread began 4/23/2009 4:00 pm by Lee Reynolds | Last modified 5/01/2009 1:39 pm by Lee Reynolds | 1644 views | 9 replies

Ray BorduinWebAssist

That is exactly what my calculation does.

Say that you had a cart with the columns:
Quantity: 2
Price: 2000
SecondDiscount: 1250
MultipleDiscount: 250

and you use the formula I gave of:
([Price] * [Quantity]) - (([Quantity]>1)?(([Quantity]-1)*[SecondDiscount]):0) - (([Quantity>0])?(([Quantity]-2)*[MultipleDiscount]):0)

I'll replace the numbers:
(2000 * 2) - ((2>1)?((2-1)*1250):0) - ((2>2)?((2-2)*250):0)

Then I'll combine a few:

(4000) - ((2>1)?(1250):0) - ((2>2)?(0):0)

the syntax ((x)?y:z) will return y if x is true and z if it is false, so above, ((2>1)?(1250):0) will return 1250 because it is true that 2>1. Using that I can further simplify the result to:

4000-1250 or 2750

Which is the expected result given your parameters.

What I did is I combined tha three line OR statement that you gave:

(([Quantity]=1)?([Price]) OR
(([Quantity]=2)?([Price])+750 OR
(([Quantity]>2)?([Price]+750)*(([Quantity]-2)*500))

and I used algebra and php to combine it into a single calculation.

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