• Default avatar
    gingerweb    
     3 years ago
    0

    I have tried this over and over again following the instructions but I cant get a product to go automatically in the cart.

    I have been through the instructions and it does seem to suggest that it will "Automatically add to cart "getY" Product" but it only does it  if I go and select one and then I end up with two of them in the cart, there doesn't seem to be any way that it works without manually entering the coupon code ?

    Am I missing something completely ?


    https://www.sassyhats.co.uk

    this item is the Buy : https://www.sassyhats.co.uk/sassy-cable-slouch/sassy-cable-slouch-airforce-detail

    This item is the free: https://www.sassyhats.co.uk/sassy-headbands/sassy-headband-airforce-detail

    The code is : oneitem

    I have setup a few coupons to test but the simplest is Buy 1 product get 1 product free but it doesn't work so far without entering the code in the coupon box and then refreshing the page - customers will never get the hang of that as we all know customers are stupid !!


    am I doing something wrong please?

  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    In the file:
    \administrator\components\com_awocoupon\helper\estore\virtuemart\class-awocoupon-helper-estore-virtuemart-discount.php
    around line 2155 is this:

    <?php
            
    elseif ( class_exists('plgSystemOPC_for_vm_bypv') ) {
                $_item 'bypv';
            }
            else {
                $_item 'none';
            }
    ?>

    Change it to this:
    <?php
            
    elseif ( class_exists('plgSystemOPC_for_vm_bypv') ) {
                $_item 'bypv';
            }
            elseif ( class_exists'plgSystemOnepage_generic' ) ) {
                $_item 'onepage_generic';
            }
            else {
                $_item 'none';
            }
    ?>


    Does that fix the issue?
  • Default avatar
    gingerweb    
     3 years ago
    0

    Thanks for that (i didnt get an email that you had replied what address does it come from please?)

    I have changed that code but if i add the "Buy X" product it still doesn't put the "GetY" in the cart automatically - it should do this shouldn't it ?
  • Your avatar
    seyi    
     3 years ago
    0

    Ok, on further inspection, I do not think the full cart html is reloaded once a coupon is applied.  On coupon success, It returns prices in the cart, and just updates the current cart.  And since the second product is not on the screen yet, you never see it.  There is no option to reload page on applying successful coupon so the only thing that can be done is to hack the code, to force the page to reload.

    First thing, remove the modification I gave you above, that seems to cause the cart to hang.

    Then find the file:
    www\plugins\system\onepage_generic\onepage.js, around line 558 is this:
                    var r = '<div class="opg-margin-small-top opg-alert opg-alert-success" data-opg-alert><a href="" class="opg-alert-close opg-close"></a><p>' + data.couponMessage + "</p></div>";

    Right above that line, add this:
                     location.reload(); return; // seyi_code

    That should cause the page to reload on successful applying a coupon.
  • Default avatar
    gingerweb    
     3 years ago
    0

    Thats great Seyi thanks for help with this, that works fine when you apply the coupon it puts an item from the "getY" in the cart - is there a way of not having to use the coupon at all? The extension sort of implies that it automatically put the item in the cart once the "BuyX" has been put into it - did I misunderstand this as a possibility?


    Once I can fully understand this I can get back to my client to find out how she would want it to work


    many thanks for your time on this


  • Your avatar
    seyi    
     3 years ago
    0

    If you want the coupon applied automatically, in admin go to

    awocoupon > coupons > automatic discount list

    And add it there.  Also you would not need to add any code to the onepage checkout if the coupon is being applied automatically, so you can remove the last addition.
  • Default avatar
    gingerweb    
     3 years ago
    0

    Ahhhh i see !!!!


    many thanks again