close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Buy One X Get One X free?

Thread began 7/29/2014 1:20 am by Nathon Jones Web Design | Last modified 7/08/2015 2:25 pm by Nathon Jones Web Design | 1867 views | 8 replies

Jason ByrnesWebAssist

Yes, you could do that , you would need to add the offerID column to the cart object and in the add to cart button set it to store the offer ID for the specific product

the calculation:
abs([offerID] == '1' && [Quantity] >= '2')?[Price]:0

would set the discount to be the value of [Price] if the offerID is 1 and the quantity is >= 2

the calculation is ternary expression, basically it is a shorthand if statement in the form of:

(Question)?true:false

so lets take an item with the following settings:
Price: 10
offerID:1
quantity: 1

the calculation
abs([offerID] == '1' && [Quantity] >= '2')?[Price]:0

would return 0 because the Quantity is not equal to or greater than 2. the question returns false and 0 is the false part of the calculation.

now set the product as:
Price: 10
offerID:1
quantity: 2

the calculation:
abs([offerID] == '1' && [Quantity] >= '2')?[Price]:0

the question is now true, so returns 10, that is the value of [Price], which is the true part of the calculation

increase quantity to 3 or above, it still returns 10


to create a calculation to apply a 10% discount, the calculation would be:
abs([offerID] == '2')?([Price] * 0.1):0

on this calculation, the product settings:
Price: 10
offerID:2
quantity: 2

would return 1 (10 * 0.1 = 1)

you could add a quantity check in there if you like:
abs([offerID] == '2' && [Quantity] >= '2')?([Price] * 0.1):0

so it only applies if the quantity is greater than or equal 2

or you could add the quantity into the calculation so that an item with quantity 3 would return 3 instead of 1:
abs([offerID] == '2' && [Quantity] >= '2')?(([Price] * [Quantity]) * 0.1):0

(10 * 3 = 30) * 0.1 = 3

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