close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Buy One X Get One X free?

Thread began 7/29/2014 4:20 am by Nathon Jones Web Design | Last modified 7/08/2015 5:25 pm by Ray Borduin | 646 views | 8 replies |

Nathon Jones Web Design

Buy One X Get One X free?

How can I apply a discount rule to achieve a buy one (of x) get one (of x) free but only on particular products?
Thank you.
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

That can get a little tricky. I'll need a little further clarification on how you want this to work.

Should they only get one for free? or for each one they purchase, should they get one for free.

In other words, if they order 4 of a product the discount applies to, should the discount be for 2 free or only 1 free and the other 3 at regular price?

where the discount applies to multiple products, do you want it to work that if they order 1 each of 2 products the discount applies to, they should get one of them free? is the discount applied to the aggregate of products it applies to or only at a product by product basis?

Sign in to reply to this post

Nathon Jones Web Design

No, it's purely buy one of X, get one of X free regardless of quantity or other items that may be on offer. Product by product basis.
Thank you
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

but what is X?

so if they buy 4 of product A and 3 of product B, they should get one each of product A and B for free?

Sign in to reply to this post

Nathon Jones Web Design

They buy 1 of product X, they get 1 product X free (X being one product!).

Thank you
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

you will need another cart column to mark the items that should get the discount. for example sakes, lets say the column is named:
buy1Get1

for items the discount applies to set the column value to 1 in the add to cart, and 0 for items the discount does not apply to

then a calcualtion to calculate the discount amount using an abs() condition:

buy1Get1Discount

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

Then create a discount to apply the discount:
triggers:
Subtotal for any column:
subtotal of column 'buy1Get1Discount' > 0

calculation:
subtotal of column 'buy1Get1Discount' plus 0

Sign in to reply to this post

Nathon Jones Web Design

Rather than a column specific to buy1Get1, is it possible to create a column that stores an identifier (int) for a range of different offers and then have the discount rule only apply if a product is set to it's corresponding identifier?

So we'd have an 'offers' table in our database:
offerID offertitle offergraphic
1 Buy One Get One Free bogof.jpg
2 10% Discount 10percentoff.jpg
etc

...and then apply the discount calculation if, in the calculation, the correct condition is met?

Considering our 'offers' table above, would I simply change the calculation to?:
abs([offerID] == '1' && [Quantity] >= '2')?[Price]:0

What is this part doing?:
?[Price]:0

I'd appreciate some clarification on the calculation and also what we'd need to do to change that calculation to offer a % discount.

Thank you
NJ

Sign in to reply to this post

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

Sign in to reply to this post

pledge204907

For a true Buy One Get One Free this calculation should work:

abs([offerID] == '1' && [Quantity] >= '2')?([Price] * floor([Quantity] / 2)):0

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