-
Notifications
You must be signed in to change notification settings - Fork 4
Rules
Sam Batschelet (hexfusion) edited this page Mar 29, 2014
·
10 revisions
hexfusion has been busy building Rules. This page is for ideas and requirements.
Requirements:
- conditions can included comparison to current date (rules can change from one day to another)
- possible to match more than one rule and produce a result for every matched rule
- must have priority so that rules are compared in a fixed order but priority does not have to be unique
- can specify a rule as LAST
- rule result is some other referenced object (tax/shipping/..)
- lots of Moo :-)
- rule can modify input args
- rule can force a jump back to the start of the rule list (RESET/RESTART?)
- rule can specify things like $zone->has_country($args->{supplier_country})
- coupons
- discounts based on delivery of service on future date (pay 8 +weeks before course for discount)
- product combination discounts: buy B with A and get 5% off A
- would be cool to be able to use coderefs for really weird conditions
- Example of multi level rule data output from find_rule_components. This should support multiple levels for all rule components.
{'1' => {'action' => {'name' => 'discount','type' => 'percentage','value' => '100'}, 'condition' => {'operator' => 'greater_than_or_equal_to','value' => '50.00'}, 'object' => {'field' => 'shipping','name' => 'Cart'}, 'result' => {'field' => 'id','name' => 'ShipmentDestination'}}, '2' => {'condition' => {'operator' => 'less_than_or_equal_to','value' => '150.00'}}}