2 rules apply to an order


  • Default avatar
    begoña    
     3 years ago
    0

    Hello,

    I have noticed a problem applying the reward rules. This problem started after some update, but I don't know when, 1 year has passed since I changed the rules configuration.

    The problem is that 2 rules are being applied to an order.

    First rule:
    - Customer Type: Everyone
    - User Group: 'Protectora de Animales'
    - Credit Type: Points

    Second rule:
    - Customer Type: Everyone
    - User Group: Empty
    - Credit Type: Points
    - Minimum Order Total: € 499.9999

    Third rule:
    - Customer Type: Everyone
    - User Group: Empty
    - Credit Type: Points

    When a client that belongs to the group 'Protectora de Animales' makes an order for less than € 500, rules 1 and 3 are applied and the points of rule 1 and the points of rule 3 are generated. 2 new lines appear in " Credit History ”for that order.

    I'm sure that long ago only the first rule that met the criteria was applied.
    What is the correct behavior? Has there been any change in operation?

    Regards
  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    Yes, the change was added in 3.6.0.0.  All rules now get processed instead of just the first found, but you can still have it process just one rule by grouping it.  When you upgraded, the upgrade should have done this for you.

    So what you need to do is create one more rule:
    - Rule type: order
    - click the 'Group rules' checkbox
    - select all the rules you want to process through first found match, in the order you want them processed

    That should do it.
  • Default avatar
    begoña    
     3 years ago
    0

    I have 5 rules registered. The first 2 are disabled.
    Could this be the reason that was not done when updating?
  • Default avatar
    begoña    
     3 years ago
    0

    I cannot add the rule and group the other rules. When adding the rules to the group I get the message 'No results fount'

    Attached screenshots.

    That could be happening?1Cj1YFj.jpg
  • Your avatar
    seyi    
     3 years ago
    0

    Not sure.  There are 2 possibilities, cache, or in the db the rules show they are already combined.  Can you look directly at the db, at

    Table: #__aworewards_rule
    Column: is_combination

    For the rules, is the value set to 'yes' or 'no'?
  • Default avatar
    begoña    
     3 years ago  last edited 3 years ago
    0

    There is no such field in the table.
    Something went wrong in the update?
    What I can do?nyGqWpQ.jpgBETcC0K.jpg
  • Your avatar
    seyi    
     3 years ago
    0

    From 3.5.9 to 3.6.0, these are the mysql updates, please run them:

    ALTER TABLE #__aworewards ADD INDEX user_id (user_id);
    ALTER TABLE #__aworewards_rule  ADD COLUMN `is_combination` enum( 'yes', 'no' ) NOT NULL DEFAULT 'no' AFTER estore;
    ALTER TABLE #__aworewards_rule  MODIFY `credit_type` VARCHAR(255);

    Where #__ is your database prefix.
  • Default avatar
    begoña    
     3 years ago
    0

    I have run the sql and now it works fine.

    Thanks.
  • Your avatar
    seyi    
     3 years ago
    0

    Great, guess there was just an issue with the upgrade in the end.