In the way I create complex rules based on Additional Conditions (rules evaluation via AND operator / indentation) I need to use the same rule more times.

But if I try to replicate a rule, the module returns an error message.

Can you consider to fix this problem?

Many thanks!

Comments

mkalkbrenner’s picture

Category: Feature request » Support request

Using the same rule multiple times is not necessary at all.
All rule cascades starting with the same rule can be collapsed to one rule cascade without loosing any functionality - pure logic.
Therefor it's a valid optimization to not allow for performance reasons.

If you post (some of) your rules I'll help you to re-arrange and reduce them correctly.

gianfrasoft’s picture

A pure logic, I know, but particularly without the OR condition the situation is very tricky!

I know the potentials of the rule cascade but the rule I have to create is a bit difficult to build without rule duplication.

For example, I'm using browscap to identify the user agent and I have to obtain this behavior:

- when the user's role is "anonymous user" and "browscap:is mobile device" is TRUE and "browscap:user agent" doesn't cointain "iPad" shows a specific mobile theme,
- when the user's role is "anonymous user" and "browscap:is mobile device" is TRUE and "browscap:user agent" cointains "iPad" shows a NON mobile theme,
- when the user's role is NOT "anonymous user" or "browscap:is mobile device" is FALSE AND "browscap:user agent" cointains "iPad" shows a NON mobile theme,
- etc.

The OR condition in these rules makes everything more tricky. Rules duplicate would make it easier.

Thank you very much!

mkalkbrenner’s picture

The rule engine runs on nearly every page request. Therefor it's a valid goal to keep it fast. That's why we won't support duplicate rules and "OR" conditions to force the user to optimize his rules.

Here's one of the possible rule sets:

user:role = anonymous user
   browscap:ismobiledevice = TRUE
      browscap:useragent !* iPad >>> MOBILE_THEME

These three lines doing all you described.

mkalkbrenner’s picture

Component: Code / API » User Interface
Priority: Major » Normal
Status: Active » Fixed

I set this ticket to "fixed" because there's no more feedback. But you can set it active again if you have further questions.

gianfrasoft’s picture

@mkalkbrenner,

your suggestion at #3 fits well my needs.

Thank you very much!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.