Believe it or not, I'm implementing my first price break system ever (I know it is a common requirement, but for whatever reason I've not had to do it before). With this system every product has a base price but also has 0..n price breaks which may or may not be unique to a given customer number.
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?