You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Hugo Cerdeira <hu...@outlook.com> on 2017/04/18 13:57:42 UTC

Promos rules, can I apply one rule OR the other?

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!

Re: Promos rules, can I apply one rule OR the other?

Posted by Giulio Speri - MpStyle Srl <gi...@mpstyle.it>.
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 <hu...@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