# eCart object - applying Discounts

Thread began 9/07/2011 5:21 am by lr_leal239405 | Last modified 9/13/2011 1:49 pm by Jason Byrnes | 887 views | 7 replies |

## 9/07/2011 5:21 am  |  #1 lr_leal239405

### eCart object - applying Discounts

I tried playing around with the eCart object to implement a discount, but had no success. The fact is I simply don't know how to start to make it work. The discount I need to implement is for bulk orders. So, for example, if the order is above 5 items, then there's a 30% discount, if the order is over 10 items, then there's a 50% discount.

Is there a step by step instruction sample that explains something similar to this?

Thank you.

## 9/07/2011 10:15 am  |  #2 Jason ByrnesWebAssist

you will need to create 2 separate discounts for this, the first one for 5 - 9 items:

Name: 5-9 items
Triggers:
"Subtotal For Any Column"
If the subtotal of column "Quantity" is ">" a value of "0"

AND
"Subtotal For Any Column"
If the subtotal of column "Quantity" is "<=" a value of "9"

Calculation:
"Based on cart subtotal"
cart Subtotal "times" "0.3"

the next one for 10 or more items:

Name: 10 or more items
Triggers:
"Subtotal For Any Column"
If the subtotal of column "Quantity" is ">=" a value of "10"

Calculation:
"Based on cart subtotal"
cart Subtotal "times" "0.5"

## 9/07/2011 5:24 pm  |  #3 lr_leal239405

Thanks. That works.

I have another dilemma though. I have different item options to add to the cart. I now have applied different discount rules for each item. It works well as long as I only add quantities of the same item. But once I add a different item, the discount from the new item is added to the previous item's discount. So if I have 35% off one items bulk order and a different item with 25% bulk discount, it applies 60% to the Grand Total. How can I limit each discount to each specific item only? I tried the following:

Condition: 'Quantity of a specific item in the cart'.
If the Quantity of item is (Here I put the ID of specific item).
Then the Calculation is based on Subtotal of column 'TotalPrice'.

I also used condition 'Number of items with a specific column value'.

As stated, works ok for one item but why does it add all the discounts together once I place other items with different discounts on basket?

Thanks again.

## 9/09/2011 10:34 am  |  #4 Jason ByrnesWebAssist

As stated, works ok for one item but why does it add all the discounts together once I place other items with different discounts on basket?

Because you using the "based on Subtotal of column 'TotalPrice'"

you should be using the "Based on items with a specific column value" option.

lets use item ID 23 as an example calculation, lets say you want to offer 25% on Quantity 1 - 9 of item ID 23, the calculation settings should be:

Triggers:
"Presence of item in the cart"
If item '23' 'exists' in the cart

AND
"Quantity of a specific item in the cart"
If the quantity of Item '23' in the cart is '>=' a value of '1'

AND
"Quantity of a specific item in the cart"
If the quantity of Item '23' in the cart is '<=' a value of '9'

Calculation:
"Based on items with a specific value"
Total of "TotalPrice" where "ID" has a value of "23" "times" "0.25"

## 9/12/2011 4:46 am  |  #5 lr_leal239405

Great. That works as well. But...I have yet another question and I hope my final question regarding this subject:

With what you gave me, I will have to set the discount 8 different times because I need to pinpoint the specific ID of 8 different items from a particular db. Can I avoid doing all that work and instead tell it to apply the same discount for all 8 items from that particular db without adding that discount to other items that are not from that db?

For example..I add a set of 10 books to the cart and get a 35% discount. That item is not in the db. Then I add a set of 10 DVDs to the cart (reading from the db), and another different set of 10 DVDs to the cart (same db), each getting a 50% discount. I don't want to have to identify each item from the DB repeating the same discount process for all items...instead I want to tell it to apply the same discount to any of the items from the db. I tried using:

'Number of items with a specific column value' combined with the calculation 'Based on items with a specific value'.

It keeps applying the discount to the other item (the book set).

## 9/12/2011 4:41 pm  |  #6 Jason ByrnesWebAssist

you can appkly a discount to multiple items at a time by using a cart column to group items into a discount catagory.

create a new cart column named discountCategory for items that should get one discount, set this column value to 1, for items that should get another discount, set the column value to 2 and so on.

you can then create dicounts for each discount category using the trigger :
"Number of Items with a specific column value"

If the number of items where "discountCategory" has a value of "1" is ">=" a value of "10"

for example.

and using the calculation:
"Based on items with a specific value"
Total of "TotalPrice" where "discountCategory" has a value of "1" "times" "0.25"

## 9/12/2011 6:08 pm  |  #7 lr_leal239405

Ok, what's happening with that last formula is that when I add a set of 10 dvds, I do get the 50% discount, but when I add an additional SINGLE dvd from that same db, it also applies 50% off that single dvd. It's not supposed to! It should only apply the discount to sets of the same dvd. I do understand why it's doing that but I don't understand how to get it to work the way I want it to. It should basically say:

"If there's 10 or more items with a specific column value and the item is unique, then apply discount"

That way another item with the same column value does not get the discount applied unless they order 10 or more of that particular item.

Thanks much for all the help. I do understand it a lot more with all the info you've given me. I would, however, like to avoid having to write the same formula for each item (16x because I have DVD and CD with different discount amount).

## 9/13/2011 1:49 pm  |  #8 Jason ByrnesWebAssist

where you want the discount to apply on product basis, you will create the discounts on a product by product basis, you cant have one global discount that is applied at the product level.

the only way to accomplish what you are after is to create individual discounts on the product level.

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

Account or customer service questions?

Need technical support?

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