# Question about database structure and eCart discounts

Thread began 2/16/2011 6:16 am by Nathon Jones Web Design | Last modified 2/17/2011 5:54 am by CraigR | 1323 views | 9 replies |

## 2/16/2011 6:16 am  |  #1 Nathon Jones Web Design

### Question about database structure and eCart discounts

Our client has a basic list of plant products as follows:

productID
productname
productprice

Our client now wants customers to be able to purchase these products in three different categories:

3 Plugs - £1.15 each
9cm Pots - £1.75 each
1 Litre Pots - £3.50 each

However, if a customer purchases large quantities of any category then a discount is to be applied and this discount needs to be different for each category. For example:

15 x Plugs = £15.00 (£1.00 each)
30 x Plugs = £29.50 (£0.98 each)

15 x 9cm Pots = £24.00 (£1.60 each)
30 x 9cm Pots = £44.32 (£1.54 each)

...and so on.

I just wanted to ask advice on the best approach to this. Should this pricing be stored in a database table and be referenced by, and calculated on, the product detail page or should I use discounts/charges in eCart?

It struck me that configuring it all in eCart could be quite a task, considering the complexity of the calculations.

Regards
Nath

## 2/16/2011 11:20 pm  |  #2 CraigRBeta Tester

with three product types, each having 2 levels of discount, this gives you 6 rules.

I would tend to do this via the discounts tab in the ecart object.

## 2/17/2011 1:56 am  |  #3 Nathon Jones Web Design

Sorry Craig, there are actually 6 levels of discount for the 3 product types so I guess that would make 18 rules?

Product Types:
Plugs
9cm Pots
1 Litre Pots

Discount Levels:
0-14 plants
15-29 plants
30-49 plants
50-74 plants
75-99 plants
100+ plants

How do I identify to eCart which product type it is? My product table doesn't have this information because each product can be all three types.

Nath.

## 2/17/2011 2:57 am  |  #4 CraigRBeta Tester

Let me try to understand your product list/structure

Lets pick Plant 1 as an example
Plant 1 is available in 3 different sizes ??, Plugs(3), 9cm pot, 1 litre pot

If I buy 5 plug sets (15) I get a discount on the standard price

If I buy 10 plug sets (30) I get a different discount ?

Same logic for the pots

Are all plants the same price??

Please let me know how this works

## 2/17/2011 3:20 am  |  #5 Nathon Jones Web Design

Yes, each plant is available in 3 different sizes:

Plug
9cm Pot
1 Litre Pot

There isn't a "plug set" as you describe it. Plants are purchased as a single product but can be either a Plug, 9cm Pot or 1 Litre Pot.

We want to apply a discount for the following bulk purchasing:
0-14 plants
15-29 plants
30-49 plants
50-74 plants
75-99 plants
100+ plants

So, in the example you've given, there wouldn't be a price difference, per plant, between 5 plants (plug size) and 10 plants (plug size) because they are both in the first discount range (0-14 plants).

However, the pricing, and discount rate, changes depending on the size you've chosen.

Here is a full breakdown of the pricing and discount rates that we're trying to acheive.

Plugs:
0-14 plants = £1.15 each
15-29 plants = £1.00
30-49 plants = £0.98
50-74 plants = £0.96
75-99 plants = £0.94
100+ plants = £0.92

9cm Pots:
0-14 plants = £1.75
15-29 plants = £1.60
30-49 plants = £1.54
50-74 plants = £1.52
75-99 plants = £1.50
100+ plants = £1.48

1 Litre Pots:
0-14 plants = £3.50
15-29 plants = £3.20
30-49 plants = £3.15
50-74 plants = £3.10
75-99 plants = £3.05
100+ plants = £3.00

I hope that makes sense. Appreciate the help Craig, thanks.
Nath.

## 2/17/2011 3:53 am  |  #6 CraigRBeta Tester

Ok then, thinking off the top of my head...

its the size that you need to use in your discount calculation.

you need to add a column for size to your ecart object, so when you have items in the cart array, you can use this to determine how many of each size you have.

presuming all plants are the same price, and that you can mix and match any combination of plants...

take 15-29 plants

the pseudo logic would be

if the number of size 'plug' is greater than or equal to 15 and less than 30, then apply a flat rate discount of 0.15 * the number of size 'plug'

so for 20 plugs, the overall discount would be 0.15 * 20 (£3.00), which equates to £1.00 per unit

Repeat...

This will give 18 discount rules which, once set up, will work fine, but take more effort to maintain if the values change regularly, or if the customer needs to have conrol over the discounts.

In this instance, you could store the discounts in a database table and interrogate this instead, but i'll leave that for now.

Hope this helps

## 2/17/2011 4:24 am  |  #7 Nathon Jones Web Design

Yes, I want people to be able to mix and match. For example, they might buy 5 plants (plugs) and 1 plant (9cm pot).

Plants are not the same price though. I think that's where I'm getting confused myself.

The cheapest you could get a plant for would be £0.92 - if you purchased 100+ plug plants.

Do I need to start with a base price for each plant, in the product table, and then apply and incremental price based on type of plant and quantity?

So, I'd basically need a "product type" table along the lines of...

typeID 1
typename Plug 0-14
typeincprice £x.xx amount

..and then a link table between that and the product table?

productID
typeID

Thanks again.
Nath.

## 2/17/2011 5:10 am  |  #8 CraigRBeta Tester

just to clarify.

"plants are not the same price though"

does this mean that plant 1 plug is different price to plant 2 plug, or that all plugs for any plant are the same price, and all 9cm pots of any plant are the same price, but different to the plug price ?

in which case what is your discount, 15p or 15% or what ?

are you uk based ? feel free to call me if that would help.

## 2/17/2011 5:43 am  |  #9 Nathon Jones Web Design

"...or that all plugs for any plant are the same price, and all 9cm pots of any plant are the same price, but different to the plug price."

That's almost correct, but the price changes depending on the quantity purchased.

All plug plants are £1.15 each unless you buy 15, in which case they drop to £1.00 each, or if you buy 30 then it drops again to £0.98...and so on (see discount scales in previous post).

The discount, therefore, isn't a percentage it is a flat rate that is dependent on the quantity chosen of any particular product type.

The flat rate discount, however, isn't constant across all types of product (plug, 9cm pot, 1 litre pot).

For example, the plug plants are £1.15 each, unless you buy 15, at which time we want the price to drop to £1.00 - that's a drop of approximately 13%.

However, the 9cm pot plants are £1.75 each, unless you buy 15, at which time we want that price to drop to £1.60, which is nearer to a 14% drop.

So, basically, we want to apply a flat rate discount that is dependent on the quantity chosen of any particular product type.

I'm going to try it with some database integration and see if I can get it to work with a flat rate discount based on the product type. As you mentioned earlier, I think this will mean that I'll have to add a new column to eCart to handle the product type variable, in order to calculate the flat rate discount based on quantity ordered.

Appreciate the help, thanks.
Nath.

## 2/17/2011 5:54 am  |  #10 CraigRBeta Tester

great. that's what i wanted to clarify.

All plants of a certain size are priced the same, its the SIZE that determines the price.
Quantity discounts apply.
any mix & match combination of plants will get the discount as long as the threshold is reached of a particular size.

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