Coupon Expiration


  • Default avatar
    eliot6    
     9 years ago
    0

    Hi Seyi,

    I have created a coupon template with a Start Date and have selected it in my AWORewards rule. The rule has Coupon Expiration set to 30 days.

    In the Profile email I have the following: The coupon is valid until {coupon_expiration}

    However when the email goes out the tag {coupon_expiration} is not populated ?

    Hope you can advise,

    regards
    Eliot
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Just tested this on a registration rule using the latest of both AwoCoupon and AwoRewards, and it works fine for me. Can you verify {coupon_expiration} is not misspelled? If that is not it, can you give me the details of the rule you created in AwoRewards?
  • Default avatar
    eliot6    
     9 years ago
    0

    Hi Seyi,

    I've PM'ed you details to access our site.

    The rule is setup as follows:

    Rule Name: Follow Us on Twitter
    Published: Yes
    Customer Type: Everyone
    Shopper Group: Not set
    Start Date: 2015-10-26 00:00:00
    Rule Expiration: Not set

    Rule Type: Follow us on Twitter

    Credit Type: Coupon - AwoCoupon
    Coupon Template: xxxxxxxx
    Coupon Expiration (Days): 30
    AwoCoupon Profile: Follow Us on Twitter

    regards
    Eliot


  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Thanks for the access. Just had a quick look, and in the profiles, one is correct, the other is not:

    Like Us on Facebook: {expiration}
    Follow Us on Twitter: {coupon_expiration}

    It definitely would not work in facebook. Where you testing twitter?
  • Your avatar
    seyi    
     9 years ago
    0

    Also I just tested your twitter template locally using a follow us on twitter rule, and it worked fine.
  • Default avatar
    eliot6    
     9 years ago
    0

    Hi Seyi,

    I'm just testing the Twitter one at the moment. Its in the email the customer gets where its says "The coupon is valid until {coupon_expiration}."

    {coupon_expiration} is empty for me in all the test emails ?

    Eliot
  • Your avatar
    seyi    
     9 years ago
    0

    Ah, I see now. The key here is it is a parent coupon template. The code used to copy the coupon does not check parent coupons, I think because initially parent coupons did not have an expiration date.

    Ok, so here is the fix:
    in www/administrator/components/com_awocoupon/plgautogenerate.php, around line 39 is this:
    <?php
            
    if($crow->function_type!='parent' && !empty($expiration) && ctype_digit($expiration)) {
    ?>


    Change that line to this:
    <?php
            
    if(!empty($expiration) && ctype_digit($expiration)) {
    ?>


    That will fix it.
  • Default avatar
    eliot6    
     9 years ago
    0

    Hi Seyi,

    Thats works. Thanks for your help with this. The file was actually in /administrator/components/com_awocoupon/helpers/

    Will this be included in the next update, or do i need to keep an eye on it for my circumstances ?

    Would that be where i would change the format as well ? Currently it comes out as YYYY-MM-DD but we prefer UK english DD-MM-YYYY

    Eliot
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    It is part of the next update. Also in the next update the date will be in the format of your shop. To do this now,

    go to www/administrator/components/com_aworewards/helpers/estore/estorerewardshandler.php, around line 1485 is this:
    <?php
                array_push
    ($dynamic_tags['replace'], $coupon_row->coupon_code$coupon_row->coupon_price, !empty($coupon_row->expiration) ? date('Y-m-d'strtotime($coupon_row->expiration)) : '');
    ?>


    Change it to this
    <?php
                array_push
    ($dynamic_tags['replace'], $coupon_row->coupon_code$coupon_row->coupon_price, !empty($coupon_row->expiration) ? JHTML::_('date'$coupon_row->expiration) : '');
    ?>


    That should do it
  • Default avatar
    eliot6    
     9 years ago
    0

    Hi Seyi,

    Just updated www/administrator/components/com_aworewards/helpers/estore/estorerewardshandler.php and tested. All working fine,

    thanks for you help with this,

    regards
    Eliot