# Tiered Quantity Discounts

Thread began 3/19/2009 4:57 am by Travis250923 | Last modified 3/20/2009 7:01 pm by Travis250923 | 7575 views | 10 replies |

## 3/19/2009 4:57 am  |  #1 Travis250923

### Tiered Quantity Discounts

I like to see more in the way of discounts especially calculating a tiered discount. For example I sell an item for \$1/ft but if you buy in 6ft sections you get a \$1 discount for each 6ft section. Well what happens if you by 7ft or 13ft? I would want it to be \$6 or \$11 respectively. I know this would be a hard calc to program but I think it would be very helpful.

Sign in to reply to this post

## 3/19/2009 7:18 am  |  #2 Ray BorduinWebAssist

Is this for every item or just the one?

If it is for every item, then you update the Total Price calculation to:

TotalPrice = ([Price] * [Quantity]) - floor([Quantity]/6)

And then maybe add a few calculations so you can display them on the page where you need to:

DiscountAmount = floor([Quantity]/6)

Now if you didn't want the discount to be applied automatically in the row, but want to show it below, then you wouldn't update the TotalPrice calculation and you would just add the DiscountAmount and define a Discount rule for the total of that Column.

I assume you use Quantity for your length in feet... if not substitite it for the eCart column name you are using.

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

## 3/19/2009 7:21 am  |  #3 Ray BorduinWebAssist

If you only wanted this for a particular item like item ID 36, then you would use something like:

TotalPrice = ([Price] * [Quantity]) - (([ID] == "36")?floor([Quantity]/6):0)

And then maybe add a few calculations so you can display them on the page where you need to:

DiscountAmount = (([ID] == "36")?floor([Quantity]/6):0)

The calculations are actually very easy and just about any discount is possible by using simple algebra.

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

## 3/19/2009 9:53 am  |  #4 Travis250923

Thanks for the help. My problem is that I don't really know PHP (I am working on learning it) and how to properly format the calcs. In your example I understand most of it but I don't understand what this is doing:

floor([Quantity]/6):0

I would like to do this on a particular item and have a similar calc that I am trying to do where items are .75 each but sold 3 for \$2. So if someone buys 4 the should be \$2.75...I assume I would do something similar for this as well?

Sign in to reply to this post

## 3/19/2009 10:12 am  |  #5 Ray BorduinWebAssist

In that case, you would add a column to your cart called: BreakQty
and add another column called: BreakAmt

Then for each item you will be able to specify the amount you need to buy to trigger the discount and the amount of the discount.

Then your calculation becomes:
TotalPrice = ([Price] * [Quantity]) - (([BreakQty] != "0")?floor([Quantity]/[BreakQty])*[BreakAmt]:0)

And your DiscountAmount = (([BreakQty] != "0")?floor([Quantity]/[BreakQty])*[BreakAmt]:0)

Then you will have complete flexability over each items discount threshold and discount amount on an item by item basis.

Floor is a mathematical term to round down to the nearest whole number. So floor(1.99) is 1. This is what handles not giving partial discounts for each item and only giving the discount for every third or sixth... since floor(7/6) is still 1 and the floor of (13/6) is still 2, this gives you the number of times the discount should be applied according to your description.

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

## 3/19/2009 10:58 am  |  #6 Travis250923

Thanks i'll play with this tonight. I assume I would place these in the spot for custom expression in the discount screen? I don't have it in front of me right now.

Thanks

Sign in to reply to this post

## 3/19/2009 11:25 am  |  #7 Ray BorduinWebAssist

Yes... that is correct

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

## 3/20/2009 8:00 am  |  #8 Travis250923

Ok so the first one to alter the price works. But if I use this for the other item I don't see how it will work because floor is going to round to the nearest integer yet when buying 4 pieces the price should be 2.75 which using floor would bring it down to \$2 right? Perhaps there is some place you know of that I can read up on this to better understand it?

I'm also not sure what I'm doing with the DiscountAmount calc you show.

Sign in to reply to this post

## 3/20/2009 9:06 am  |  #9 Ray BorduinWebAssist

.75 each but sold 3 for \$2... lets say 4 items

Formula with the numbers replaced would then be:

TotalPrice = (0.75 * 4) - ((3 != "0")?floor(4/3)*0.25:0)

which is equal to:

TotalPrice = 3 - (1 * 0.25)

or TotalPrice = 2.75

The formula is correct. Have you tried it?

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

## 3/20/2009 9:41 am  |  #10 Travis250923

Ahh I was misunderstanding where/when 'Floor' was applied. That makes sense. I haven't tried it because I was having problems with the calculation tab that I need to enter a supp ticket for. Every time I tried to add a calc eCart kept truncating it.

I would enter:

(([ID] == "36")?floor([Quantity]/6):0)

Press the Enter Key and then it would change to be (([ID] ==

I got frustrated last night and gave up. I have since found that if I click on another tab I am asked to save the calc which then saves it but I haven't had a chance to test it out yet because I need to add the new columns, update my database and then set the cart to populate populate these columns.

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.

## Everything else!

Close Window

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

Layout

Ease of use

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 Window

## We were unable to retrieve the attached file

Close Window

### Attach and remove files

• Text Formatting
• Insert Element
• Insert Link
• Block Formatting
• Cancel
Close Window

Close Window

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