AwoCoupon at Newsletter signup with Virtuemart Shopper Groups


  • Default avatar
    eliot6    
     2 years ago
    0

    Hi Seyi


    My goal is to create a coupon for 10% off first 'retail' purchase on newsletter signup,  that excludes certain shopper groups i.e. 'Trade' users.


    I have created a Coupon Template 'FIRSTPURCHASE' (see screenshot below), with User groups exclusions.


    Next I create an Acymailing Welcome email with dynamic text (AWOCoupon plugin for Acymailer) inserted referencing the coupon template.


    Then I signed up for the Newletter and received the email with newly generated coupon.


    I can see the coupon generated in Awocoupon (screenshot below) for the user that signed up, but the shopper group exclusions are gone?

    Coupon Template FIRSTPURCHASE

    Hope you can advise?


    regards

    Eliot

  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    If you go to awocoupon > coupons > generate coupon, and generate 1 coupon, and look back at the coupon list.  Is it generated with the exclusion?
  • Your avatar
    seyi    
     2 years ago
    0

    Actually, I see what is happening.  It is because you set the coupon to be exclusive to the customer, so it is deleting all customers and usergroups from the generated coupon.  Here is how to fix it, in the file:
    www/administrator/components/com_awocoupon/awocoupon/library/class-awocoupon-library-coupon.php around line 130 is this line of code:
    <?php
                AC
    ()->db->query'DELETE FROM #__awocoupon_asset WHERE asset_key=0 AND asset_type IN ("user","usergroup") AND coupon_id=' $gen_coupon_id );
    ?>

    Change it to this:
    <?php
                AC
    ()->db->query'DELETE FROM #__awocoupon_asset WHERE asset_key=0 AND asset_type IN ("user") AND coupon_id=' $gen_coupon_id );
    ?>

    And around line 137, remove this:
    <?php
               
    unset( $params['asset'][0]['rows']['usergroup'] );
    ?>

    That should fix the issue.
  • Default avatar
    eliot6    
     2 years ago
    0

    Hi Seyi,


    Thanks I will try this and get back to you.


    If the user is in any of the exclusion groups then the coupon shouldn't work regardless of wether it is exclusive to the customer?


    thanks

    Eliot

  • Default avatar
    eliot6    
     2 years ago
    0

    Hi Seyi


    That works great thanks. Will this be in an update, or do I need to make change after each update?


    thanks

    Eliot

  • Your avatar
    seyi    
     2 years ago
    0

    It will be in the next update, so you do not need to worry about adding it in the future.

    And to your first question, yes, exclusions take precidence over inclusions.  If you include a customer, and exclude the group they are in, then they will be excluded from the coupon.
  • Default avatar
    eliot6    
     2 years ago
    0

    Great, thanks Seyi
  • Default avatar
    eliot6    
     2 years ago
    0

    Hi Seyi


    I have noticed an issue with the AwoCoupon/AcyMailing plugin and the process i'm using above.


    I just did a test as a guest user accessing the site. The popup opens and they subscribe to the newsletter, then AcyMailer sends them the email with an automatically generated coupon code inside. All good so far.


    The users then adds items to the cart and when they get to the cart they decide to register (using OPC from virtueplanet).


    The cart then shows. when they go to enter the code they get the message :

    ‍6aA8GTkwqD: No record, unpublished or expired

    In the backend I can see the generated coupon. However it seems its no longer linked the guest user.

    Coupon Code


    Hope you can advise?


    regards

    Eliot

  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    Need to know where it is failing.  If you already have debug on, then basically the coupon does not exist, so this could not be the case.  Can you go to awocoupon > configuration > error messages, click the debug button, and save, then try the coupon again?  What is the error you receive?
  • Default avatar
    eliot6    
     2 years ago
    0

    Hi Seyi


    I have already left it set as debug, and coupons are created that work? The message is:

    ‍6aA8GTkwqD: No record, unpublished or expired

    But it does exist:

    pQchzYc.png

    regards

    Eliot

  • Default avatar
    eliot6    
     2 years ago
    0

    Hi Seyi


    This user was a guest when they received the coupon ... then they registered on the cart page.

    thanks

    Eliot

  • Your avatar
    seyi    
     2 years ago
    0

    I cannot produce this situation, so really no idea what is going on.  I am happy to look at it if you can send a private message with temp access.
  • Your avatar
    seyi    
     2 years ago  last edited 2 years ago
    0

    Thanks for the access.  Tried the coupon, 6aA8GTkwqD, and for me it worked.  Tried it both as a guest and registered user:UKMMAdV.png



  • Default avatar
    eliot6    
     2 years ago
    0

    Hi Seyi


    That should only have worked for the subscriber based on the email they subscribed with?


    I've tried again as guest user who then registers at the checkout and its not working.


    regards

    Eliot

  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    In creating an AwoCoupon coupon, there is no feature to include/exclude an email.  You can include/exclude a user.  So if a customer is not registered at the time of the coupon being generated then it will not be restricted to that user.