Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Implementing complex pricing logic in php/mysql - decision tables?

11:48 pm on Sep 16, 2012 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 2, 2003
votes: 0

How would one go about creating a php/mysql pricing system in which complex pricing rules (ie discounts, extra charges) for each product can be stored and executed most efficiently? Key thing is also scalability.

I understand adding a few rules in PHP programming logic will solve things, however such a system requires constant development (to continue adding new rules when they appear) usually creating a bottleneck.

Then I stumbled across something called "decision tables" according to a post here - [jonathanlevin.co.uk ]

Would something like this fulfill the requirements for me or do you see anything else suiting this task better? Key thing for me is ability to quickly add rules and scale the system indefinitely without slowdowns. Ability for non-developers to modify rules themselves is also required.


Product A Cost $100
Discount Rules:
Jan - Mar 10% off
Mar - Apr: 5% off if > 2 items purchased
-$10 if buyer spent $1000 in past

Extra Charge Rules
If customer in europe + $50 shipping
If customer in usa + $10 shipping
If something = 'bananas' add 5% charge

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members