ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giulio Speri - MpStyle Srl <giulio.sp...@mpstyle.it>
Subject Re: Promos rules, can I apply one rule OR the other?
Date Thu, 20 Apr 2017 17:23:10 GMT
Hi Hugo,

I'm also working on the Promos in these days and I'm facing the problem.
I think that there is no explicit way exclude rule execution based on the
result of the previous rules.
If you check the code the handles promos ( class *ProductPromoWorker, *
method* doPromotions()* in *order/shoppingcart/product*), you can see that
product promos are processed individually, that is for each promo are
checked sequentially all the rules, and for each rule, conditions: if any
of the conditions of a rule fail, that rule won't be applied; and so on for
all the rules in a promotion.
So the execution or not of a specific rule depends only on the conditions
(if any) for that rule and not on execution result of other rules.

I think that if you want to achieve your goal you should think conditions
that mutually exclude rules, for example :

Rule 1 -> conditionA (where conditionA is "Cart Sub-total > 100");
Rule 2 -> conditionB (where conditionB is "Cart Sub-total < 100");

In this way if the Rule 1 is applied I'm certainly sure that Rule 2 won't
be, because the two rules are mutually exclusive.
But this work could not be so ordinary if more rules and more conditions
are added to the promo.

I hope I've been helpful!

Giulio


2017-04-18 15:57 GMT+02:00 Hugo Cerdeira <hugo.cerdeira@outlook.com>:

> Hi everyone,
>
> I'm trying to make a promotion, where there are a fair bit of rules, and I
> want to activate one and only one of the rules, as if the rules had the
> operation OR between them, is this possible?
>
> Rule1-> conditions = false, don't execute the actions.
> Rule2-> conditions = true, execute the actions
> Rule3-> don't do anything since rule2 already was true.
>
> Thanks!
>



-- 
Giulio Speri

*Mp Styl**e Srl*
via Antonio Meucci, 37
41019 Limidi di Soliera (MO)
T 059/684916
M 334/3779851

www.mpstyle.it

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message