AwoCoupon at Newsletter signup with Virtuemart Shopper Groups


  • Default avatar
    eliot6    
     7 days 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    
     6 days 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    
     6 days 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    
     6 days 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    
     4 days 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    
     4 days 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    
     4 days ago
    0

    Great, thanks Seyi