How do you handle price breaks in e-commerce?
I'm trying to come up with a best practices reusable approach to this as I don't love the implementation I'm being asked to do (in this system if there is a customer price, it replaces ALL quantity breaks which to me is somewhat of a special case. Also in this case there is a break price but not a range making it effectively impossible to merge customer specific and generalized pricing breaks - again fine for this use case).
It seems to me a generalized solution would include a product identifier (ID, SKU, etc.), customer identifier, min qty, max qty and price per. You could then optionally set store rules about how to merge customer specific and general pricing, and you could still cover special cases like this project by setting the range from 1 to an arbitrarily high number where you wanted a given price to override general pricing.
Also, do you come across systems where it is a numeric or percentage discount for the ranges? Perhaps instead of a price, a "Number" and "Type" (price, discount percentage or discount amount) would give a little more flexiblity?
Any thoughts from anyone who has implemented a few more of these? I understand there is never a one true way, but I'm looking for a flexible data structure and algorithms with a few proeprty settings to cover the vast majority of small to mid sized business use cases.
Thoughts?


There are so many variables it's difficult to come up with something that covers everything... I would say numeric and percentage discounts are popular. I had a cart where depending on what you ordered (and how many) you would get something for free. Or if you bought a certain number you would get a percentage off the total, etc.
Lets say product A has an Option of 'red' which adds $10 to the price. Some customers would want the discount of 5% off to only cover the product and not the option as well. Others say both.
Something I have done in the past is:
ID - Type (percentage, numeric, volume purchase) - amount_applied - volume_size - apply_to_options
So any product can be associated with the id via join tbl and from that you know how to apply the discount and what type. The tricky part is if there are multiple discounts applied. Depending on how you order them you could get a different end result.
I know what you're saying :-> I'm lucky that by dealing with smaller clients and budgets aI can often "direct" them towards a more affordable (configuration based) solution. Also I handle those kind of discounts separately from price breaks. For me price breaks are only ased on quantity of a single item. I implement total order price or quantity breaks as universal discount codes and I'm working up a couple of other systems for package based ordering and 11 for the price of 10 style promotions. Gol is to have a bunch of types of discount engines with configurable rules over how they interact to create a fairly flexible total solution. We'll see :->
Nice catch. Have you been holding out on me? Thought you mainly did cms's given your job. Didn't realize you also did commerce :-> I like the idea of the option to apply discounts just to base price or to attribute pricing if the discount is an amount off as opposed to a new price. Thanks!
So, how many little pet projects have you going on right now? I know of a couple but won't name them just in case they are still under wraps :->
I was able to bang it out in a couple of hours, but needless to say it's completely outside our normal discounts scheme, which is coupon based - not exactly a reusable solution.
I don't know how you could ever anticipate every possible discount scheme. Once you think you have them all accounted for, someone will come up with something new.
I'm afraid this area is one of the gnarliest to deal with in ecommerce, so I don't have any great solutions for you. All I can say is good luck!!
Thanks for the heads up. Checking it out now. For anyone else interested, most information seems to be at http://ofbiz.apache.org/
PRODUCT_TBL
---------------------------
IDPK
SKU
....
PRICE_TBL
---------------------------
ID
PRODUCT_UID_FK
LISTPRICE
TIERPRICE_TBL
---------------------------
PRICE_UID_FK
QUANTITY
LISTPRICE
Above you have a product which has a price. The price can have 1 to n tierprices which should be looked up by the prices id and the quantity.
Josh Bouchair