AwoCoupon Pro adding discount to total


  • Default avatar
    steve91    
     3 years ago
    0

    Hi,

    I have upgraded my Joomla 2.5.14 site to virtuemart 2.0.24. I have just updated Awocoupon PRO to the 2.2.3 release and it is now adding the discount.

    What is the correct solution?

    Thanks

    Steve
  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    That is strange. Are you sure you are using the latest version of AwoCoupon, 2.2.3? Because this should fix the discounting being added. Do you have any mods in either AwoCoupon or Virtuemart?
  • Default avatar
    steve91    
     3 years ago
    0

    Hi Seyi, Thanks for the response.

    Yes I'm definitely on 2.2.3 - AWOCoupon says:

    Latest Version Installed
    Installed Version: 2.2.3

    I have some mods to virtuemart. Coupons were calculating correctly before I did the AWO upgrade. The only thing I changed was doing the AWO upgrade which I did direct from the AWO Coupon component rather than by downloading the latest version and using extension manager.. I jumped directly from version 2.1.9. to 2.2.3

    Steve
  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    I cannot explain it then. Here is where the code was changed to compensate for Virtuemart changing the coupon behavior in version 2.0.21:
    www/administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php, around line 181 is this line:
    <?php
            $negative_multiplier 
    version_compare($vmversion'2.0.21''>=') ? -1;
    ?>


    For versions 2.0.21 and up, the variable should come out negative. You can alternate the variable between negative and positive to see what works for your installation. Like this:
    <?php
            $negative_multiplier 
    1;
            
    $negative_multiplier = -1;
    ?>


    Please post back with what works.
  • Default avatar
    steve91    
     3 years ago
    0

    Hi Seyi,

    Thanks for the help.

    I removed all of line 181: $negative_multiplier = version_compare($vmversion, '2.0.21', '>=') ? -1 : 1;

    and replaced it with: $negative_multiplier = 1;

    My discount coupons are now calculating correctly.

    Thanks fir the help.

    Steve


  • Your avatar
    seyi    
     3 years ago
    0

    Ok, glad it works but do not understand why. If you update AwoCoupon in the future, you would need to make that change again.
  • Default avatar
    Mike Geelhaar    
     2 years ago
    0

    Hi

    I have the same problem, but i have Awo-coupon version 2.0.9 pro and Joomla 2.5.14 with virtuemart 2.0.26d
    Can you help me?
    I don´t can find this row.
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    In that version of AwoCoupon, you would not. YOu should try this solution:
    https://awodev.com/forum/awocoupon/help-section/awo-coupon-virtuemart-adding-coupon-amount-instead-subtracting-it#comment-5577
  • Default avatar
    Mike Geelhaar    
     2 years ago
    0

    Hi

    I can´t find this row, in my versie is this:
    130 AND coupon_code IN ("'.$coupon_codes.'")
    131 ORDER BY FIELD(coupon_code, "'.$coupon_codes.'")';
    132 $db->setQuery( $sql );
    133 $coupon_rows = $db->loadObjectList();
    134 if(empty($coupon_rows)) return $this->return_false('errNoRecord');
    .
    .

    Thanks for you massage.
    When I use the 2.0.11. free al is ready, but this dont can give shippingcost discount´.
    So I wil use the pro-versie.
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    I am confused. Why are you looking for those lines? You should be looking for

    <?php
    $this
    ->vmcartPrices['salesPriceCoupon'] =...
    ?>


    To fix the problem with the coupon being added instead of subtracted.

    In 2.0.9 pro, you should find the lines around 1576, you want to change
    <?php
            $this
    ->vmcartPrices['couponTax'] = $product_couponTax $shipping_couponTax;
            
    $this->vmcartPrices['couponValue'] = $product_couponValue $shipping_couponValue $this->vmcartPrices['couponTax'];
            
    $this->vmcartPrices['salesPriceCoupon'] = $salesPriceCoupon;
    ?>


    to
    <?php
            $this
    ->vmcartPrices['couponTax'] = $product_couponTax $shipping_couponTax *-1;
            
    $this->vmcartPrices['couponValue'] = $product_couponValue $shipping_couponValue $this->vmcartPrices['couponTax'] *-1;
            
    $this->vmcartPrices['salesPriceCoupon'] = $salesPriceCoupon *-1;
    ?>


    Another solution would be to upgrade your version of AwoCoupon Pro.