Instant coupon Code on Registration


  • Default avatar
    edgar8    
     5 years ago  last edited 5 years ago
    0

    I have an email template + registration rule working fine.

    However, I would prefer the coupon code to be visible to the registrant immediately upon completion of registration rather than emailing it to them.

    Is this possible?

    Thanks
  • Your avatar
    seyi    
     5 years ago
    0

    Unfortunately AwoRewards is not set up to work that way.  Depending on your setup, could probably add custom code to do this.
  • Default avatar
    edgar8    
     5 years ago
    0

    Ok, because most people register and place their order in the one sequence.
    We have many people registering but only very few take the discount.
    Kindly email me with the procedure/price to customise.
  • Your avatar
    seyi    
     5 years ago  last edited 5 years ago
    0

    I do not have any code that does this.  But here is how you can access the code created.  First you would need to know the rule_id.  I assume it is 17.

    <?php
    $rule_id 
    17;
    $user_id JFactory::getUser()->id;
    $db JFactory::getDBO();
    $coupon_code $db->setQuery'
            SELECT c.coupon_code
              FROM #__awocoupon c
              JOIN #__aworewards r ON r.coupon_id=c.id AND r.credit_type="awocoupon"
             WHERE r.rule_id=' 
    . (int) $rule_id ' AND r.user_id=' . (int) $user_id '
    );

    echo 
    $coupon_code;
    ?>

  • Default avatar
    edgar8    
     5 years ago
    0

    In table _aworewards,  rule_id = 1 &  rule_type = registration
  • Default avatar
    edgar8    
     5 years ago
    0

    Where does your code go?
  • Your avatar
    seyi    
     5 years ago
    0

    It would go on your landing page after registration.  Or you could create a plugin add it as a system message so whatever page the customer lands on it shows.
  • Default avatar
    edgar8    
     5 years ago
    0

    Thank You!
  • Default avatar
    edgar8    
     5 years ago
    0

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 2)' at line 3
  • Default avatar
    edgar8    
     5 years ago
    0

    XUYUojs.jpg
  • Your avatar
    seyi    
     5 years ago
    0

    I tested the sql statement I posted above, it does not produce an error.  Maybe if you turn on debug mode in Joomla it will tell you exactly what sql statement is causing the error.