# Applying Discounts to Only Certain Items

Thread began 9/29/2009 7:57 pm by duncanc213061 | Last modified 10/05/2009 2:08 pm by Jason Byrnes | 1524 views | 9 replies |

## 9/29/2009 7:57 pm  |  #1 duncanc213061

### Applying Discounts to Only Certain Items

I am trying to apply discounts to certain items. If a customer buys six golf clubs, then no discount. If customer buys 7 golf clubs, then the 7th one is at an \$18.00 discount. If customer buys 8 golf clubs, then the 8th one is an additional \$18.00 discount.

I have tried every combination (I think), but I cannot get the discounts to work (without some major mathmatical acrobatics.

I do not want to change the structure of the database (only as a last resort). You should be able to do discounts directly in eCart.

I have been working on this for quite some time, and I am at my wits end. Please help!!

## 9/30/2009 1:10 pm  |  #2 Jason ByrnesWebAssist

Your cart will need to have a column for category to determine whether the discount should be applied or not.

this calculation assumes the category is set to "1" in the add to cart button for golf clubs:

Set the TotalPrice calculation to:
(([Price] * [Quantity]) - (([Quantity]>6 && [category]=='1')?(([Quantity]-6)*18):0))

if you want to display the savings, create an new calculation called savings:
([Price] * [Quantity]) - (([Price] * [Quantity]) - (([Quantity]>6 && [catagory]=='1')?(([Quantity]-6)*18):0))

When you create your cart display page, on the second page off the disp[lay manager, you can select columns to show, click the plus button and select the saving calculation to show it in the cart display.

## 9/30/2009 6:24 pm  |  #3 duncanc213061

### Applying Discounts to Only Certain Items

I will give it a whirl tommorrow, as I am brain-dead today. Will this affect any other products in the store. I want it for only 2 types of clubs (those that have a minimum of 6 clubs).

## 9/30/2009 7:08 pm  |  #4 Jason ByrnesWebAssist

as long as you have a category column in the cart and you set it to 1 for items it should apply to and 0 for items it should not apply to, it will not affect those it should not apply to.

## 10/01/2009 3:01 pm  |  #5 duncanc213061

### Applying Discounts to Only Certain Items

i have used the calculations that you provided and I get this error:

Technical Information (for support personnel)

Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/drbirdie/WA_eCart/birdie_VB.asp, line 294, column 77
itmObj.TotalPrice = ((itmObj.Price * itmObj.Quantity) - ((itmObj.Quantity>6 && itmObj.category=='1')?((itmObj.Quantity-6)*18):0))'c
----------------------------------------------------------------------------^

I have enclosed a zip file that has the two files (Rissa_2.asp, and birdie_vb).

I also have a second set of clubs that have a minimum of six clubs, and the 7th is discounted at \$15.00 and the eighth is discounted at an additional\$15.00, and so on. Am I required to have a second category for the discounts, or am I going to modify the database for this?

I am confused about the discounts for this, as the other discounts are working properly.

Attached Files
rissa.zip

## 10/01/2009 3:16 pm  |  #6 Jason ByrnesWebAssist

I did not realize you where using ASP, the calculations where writen for PHP. In asp the calculations should be:
Set the TotalPrice calculation to:
(([Price] * [Quantity]) - (([Quantity]>6 &[category]='1')?(([Quantity]-6)*18):0))

if you want to display the savings, create an new calculation called savings:
([Price] * [Quantity]) - (([Price] * [Quantity]) - (([Quantity]>6 & [catagory]='1')?(([Quantity]-6)*18):0))

You will either need to crate a second category, or add another column for named DiscountAmount you would need to add that column to the database as well, and change the calculation to:
Set the TotalPrice calculation to:
(([Price] * [Quantity]) - (([Quantity]>6 && [category]=='1')?(([Quantity]-6)*[DiscountAmount]):0))

if you want to display the savings, create an new calculation called savings:
([Price] * [Quantity]) - (([Price] * [Quantity]) - (([Quantity]>6 && [catagory]=='1')?(([Quantity]-6)*[DiscountAmount]):0))

## 10/01/2009 5:25 pm  |  #7 duncanc213061

### Applying Discounts to Only Certain Items

I have tried it again, and I am getting the error:

Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/drbirdie/WA_eCart/birdie_VB.asp, line 294, column 93
itmObj.TotalPrice = ((itmObj.Price * itmObj.Quantity) - ((itmObj.Quantity>6 &itmObj.category='1')?((itmObj.Quantity-6)*18):0))'w
--------------------------------------------------------------------------------------------^

Also, it does not like the character ' after itmObj.category= '1', as it comments out the last of the calculation.

## 10/02/2009 5:27 pm  |  #8 Jason ByrnesWebAssist

Sorry, for asp the correct calculation is:
TotalPrice
(([Price] * [Quantity]) - (Abs([Quantity]>6 AND [category]="1")*(([Quantity]-6)*18)))

Savings:
([Price] * [Quantity]) - (([Price] * [Quantity]) - (Abs([Quantity]>6 AND [category]="1")*(([Quantity]-6)*18)))

## 10/02/2009 8:50 pm  |  #9 duncanc213061

The cart page is still causing the price to show as full price, rather than the discounted price.

Each club less than six is \$46.00, and the seventh through tenth clubs are discounted at \$28.00.

There must be another step that I am not seeing.

Am I missing something here??

## 10/05/2009 2:08 pm  |  #10 Jason ByrnesWebAssist

Create a new cart display page for testing purposes,

When you apply the Cart Display Manager to the page, on the Second step of the Cart Display Wizard, click the Plus button and select All so the cart display will show all columns that are in the cart.

When you add a club to the cart, does the category column have a value of 1?

The calculation I gave you relies on the category column being given a value of 1 for items that should be given the discount.

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