Andy Xu's weblog: Commerce Server, .net and more

Extend Commerce Server 2002 discount functionality, Part 1 (tiered discount)

Why needs to extend

 

Commerce Server 2002 provides a powerful discount engine. It can process basket line item level discount, order level discount, dollar off or percentage off discount and multiple discount interactions (for example, same basket item can be awarded by two or more different discounts). As powerful as it is, the design goal of discount engine is to supply a general useful functional component. So when it comes to each real business scenario, it is possible and necessary for developers to extend the CS2002 discount engine to build their own solutions for special requirements.

 

After seeing and trying to use variety of discounts in real world, I find there are certain types of discounts which are not rare but requiring customized work on top of Commerce Server 2002. (isn’t that one of the cool things of working in Commerce Server team -- You really get chance to think about some everyday issues from different perspective?) I have my own solutions for those scenarios and I want to share them here to get your thoughts and feedbacks. Hey, your solution is probably different and more importantly, better. In that case, why not also share yours as well?

 

Extension 1: implementing tiered discount

 

A typical tiered discount is using the same condition but giving out different award based on different purchase amount. So an real world example would be:

 

Discount to sell CDs, get 5% off if buying over 10 CDs, get 2% off if buying 5 to 10 CDs, get 1% off if buying less than 5 CDs.

 

Before we get into my solution, let me mention a little bit about Commerce Server 2002 discount. In Commerce Server 2002, discount is in a fixed format. In you have been using bizdesk or Feature Pack 1 discount manager, you know what I am talking about: Most basically and importantly, a discount has 3 parts: Condition, Award and Offer. A discount may look like:

Buy some product A,   Get some other product B,   at something ($ or % or free) off

|ß-----condition-à|  |ß-------- award ------à|  |ß------- offer ----------------à|

 

Of course, there are other (more advanced) parts of discounts, like eligibility requirements, priority, interaction policies, basket display and for new released feature pack 1, the coupon (promotion) code.

 

So as you can see, classic commerce server 2002 discount is not an out-of-box solution for tiered discount, which requires the same condition product (CD) but different offer and condition amount.

 

My solution is to create one discount for each tier and use discount priority to achieve the order the applied discount and finally use interaction policy to make sure only one tier discount is applied.

 

For example, in the above case (discount to sell CDs), I will create three discounts because of there are three tiers: <5, 5 to 10, >10. Please note since Commerce Server 2002 discount doesn’t take a range (5 to 10) as purchase condition amount, we need to specify the minimal value in the range instead. My three discounts are:

 

D1: (for tier: over 10)     Buy 11 CDs, get unlimited CDs, at 5% off

D2: (for tier: 5 to 10)      Buy 5 CDs, get unlimited CDs, at 2% off

D3: (for tier: less than 5) Buy 1 CD, get unlimited CDs, at 1% off.

 

You may notice that I put the tier with most purchase amount first. That’s actually the discount priorities we should assign: D1 > D2 > D3 (in bizdesk, the lower the priority number, the higher the priority. So the value is bizdesk in fact should be D1 < D2 < D3). The reason D1 should have higher priority than D2 and D2 should be higher than D3 is because “more exclusive first”. When purchase amount meets D1 condition, it should also meet D2 and D3’s conditions but in that case, we want discount D1 to be applied. Only when D1 or D2 can’t be applied (at this moment, the purchase amount must be less than 5), D3 will be applied.

 

And relationship between tiers is exclusive – at one time, only one tier discount can be applied. So we need to set higher prioritized discount’s interaction policy to be exclusive: Condition can not be reused as other discounts’ condition or award; award can not be reused as other discounts’ condition or award. Fortunately, those are the default values and we don’t have to modify anything.

 

One last piece is what we call “disjoint flag”. That is within each discount, we want discount to be applied to condition items as well. For example, shopper adds 12 CDs to his basket, the first 11 CDs will be used as discount D1’s condition and we want the award to be applied not only to the other 1 CD but the condition items, the 11 CDs as well. To accomplish that, in bizdesk, discount definition section, check “Apply offer on both Get and Buy products” box. In feature pack 1 discount manager, discount properties window, check “Allow award to apply to the discount condition items” box.

 

In feature pack 1, we do add coupon functionality, if it is wanted to add a coupon definition to this tiered discount, it is a good practice to let all discounts for different tiers share the same coupon definition. – It makes a consistent user experience for shoppers.

 

Drawback of the solution above is extra maintenance cost. Instead of one discount (if Commerce Server 2002 provides an out-of-box solution), we have N discounts (let’s assume N is the number of tiers). It probably doesn’t make sense to remove one or parts of tiers in most cases. So as a developer, you have to ask business manager to treat all of N discounts as a whole – Active/deactive/remove/modify start, end time for all of them. Of course, you can also create some other pieces of customized codes to help the maintenance.

Published Friday, July 09, 2004 12:08 PM by yuxiangxu

Comments

 

mark.meehan@gmail.com said:

This is great. Another much needed discount is the one time only discount. I have searched high and low for an example of offering a discount that can only be used once per user.
July 23, 2004 8:05 AM
 

Andy Xu said:

Mark,

private coupon (promocode), which is available in Feature pack 1, is a perfect solution for one time only discount. Take a look at my blogs in June, which talked about new coupon functionality.

Thanks,
-- Andy
July 23, 2004 10:17 AM
Anonymous comments are disabled

This Blog

Syndication

Tags

No tags have been created or used yet.

News

    These postings are provided "AS IS" with no warranties, and confer no rights.
    Use of included script and code samples are subject to the terms specified here.

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker