AwoRewards rule not saving


  • Default avatar
    peter49    
     8 years ago
    0

    Hi, I'm trying to set up a rule for rewarding a sponsor, when a friend buys something.

    I set it up like this:

    • sponsor emails a coupon code to a friend

    • friend buys something and redeems the code

    • sponsor receives 20% coupon



    I made a test order, but the 20% coupon was mailed to the friend and not to the sponsor.

    The rule I set up:
    rule name: referafriend
    published: published
    customer type: everyone
    rule type: order
    minimum order total type: all orders
    minimum order total: 1
    credit type: coupon Awocoupon

    I tried to make the 'customer type -> sponsor' but when I save the rule, this field jumps back to 'everyone'. I made an earlier forum post about this here but got no answer:

    https://awodev.com/forum/other-applications/aworewards/cannot-save-customer-type

    Any help on how to fix my problem? Thnx.

    Config: Joomla 3.4.8 + AwoRewards 2.2.6
  • Your avatar
    seyi    
     8 years ago
    0

    Hello,

    I just tested this locally. I selected the customer type 'sponsor (>)' and it saved fine. I also edited it changing it to everyone and then back to sponsor and it works fine, using AwoRewards 2.2.6.

    Actually, do you see these options in the customer type:
    - Sponsor (>)
    - Sponsor (>>)
    ...



  • Default avatar
    peter49    
     8 years ago
    0

    Hi, yes I see those options. I can also select them from the dropdown. But when I click save&close, it goes back to 'everyone'.
  • Your avatar
    seyi    
     8 years ago
    0

    Still, wonder is there is some type of database error. Can you go to global configuration->system and set 'debug system' to yes temporarily then try saving the sponsor again?
  • Default avatar
    peter49    
     8 years ago
    0

    Ok done, still saving to 'everyone'. I see no specific information in the debug part. Do you want to have a look?
  • Your avatar
    seyi    
     8 years ago
    0

    Thanks for the access, took a look. If you look at the rules list the customer type column is blank for this rule. Now I think you have to look directly in the database at:

    tables: #__aworewards, #__aworewards_rule
    column: customer_type

    They should both have the definition:

    customer_type ENUM('everyone','friend','recipient','sponsor','sponsor1','sponsor2','sponsor3','sponsor4')
  • Default avatar
    peter49    
     8 years ago
    0

    OK, but does this mean there is something wrong with my installation?
  • Your avatar
    seyi    
     8 years ago
    0

    Yes, might be, you can compare the tables in the database with the file in aworewards at:

    www/administrator/components/com_aworewards/helpers/install/mysql.install.sql
  • Default avatar
    peter49    
     8 years ago
    0

    Ok the field has the following value: [ enum'everyone','sponsor','recipient' ]. Could be from an old installation, I've had AwoRewards for a while.

    But I don't know how to correct that, the field is read only.

    Maybe uninstall > install?

    Because in mysql.install.sql, the value is correct.
  • Your avatar
    seyi    
     8 years ago
    0

    You can run database query to fix it:

    ALTER TABLE #__aworewards MODIFY customer_type ENUM('everyone','friend','recipient','sponsor','sponsor1','sponsor2','sponsor3','sponsor4');
    ALTER TABLE #__aworewards_rule MODIFY customer_type ENUM('everyone','friend','recipient','sponsor','sponsor1','sponsor2','sponsor3','sponsor4') NOT NULL;

    UPDATE #__aworewards SET customer_type='friend' WHERE customer_type='recipient';
    UPDATE #__aworewards_rule SET customer_type='friend' WHERE customer_type='recipient';
    UPDATE #__aworewards SET customer_type='sponsor1' WHERE customer_type='sponsor';
    UPDATE #__aworewards_rule SET customer_type='sponsor1' WHERE customer_type='sponsor';


    Make sure you change #_ to your actual database prefix
  • Default avatar
    peter49    
     8 years ago
    0

    Ok that worked, thanks!