Wrong Value after Coupon


  • Default avatar
    eamon5    
     12 years ago
    0

    Hi,

    Im having an issue where there is a stray small value after the use of a coupon:

    Example:

    3x Pillows @ 59euro = €177

    Enter 2 Coupon Code's each set to value €59 = €177

    The value left is .02c for some reason.

    You can view this at:

    www.caseys.ie/grabone

    use voucher codes: 10035;10036;10037

    Any ideas?

    Thanks,
    Fionn
  • Your avatar
    seyi    
     12 years ago
    0

    the rounding issue had to do with the quantity, and dividing out the price to be proportional. not very easy to explain so will leave out the details. Basically it is a rounding issue. if anybody experiences this using version 1.4.1 or earlier, then this should fix it:

    in www/administrator/components/com_awocoupon/assets/virtuemart/ps_coupon_process.php, around line 1085 is this
    <?php
        $discount 
    min(round(($coupon_value-$tracking_discount)/$row['qty'],2),$row['product_price']);
        
    $global_cart->items[$k]['product_price'] -= $discount;
        
    $tracking_discount += $row['qty']*$discount;
    ?>


    change it to this
    <?php
        $discount 
    min(($coupon_value-$tracking_discount)/$row['qty'],$row['product_price']);
        
    $global_cart->items[$k]['product_price'] -= $discount;
        
    $tracking_discount += $row['qty']*round($discount,2);
    ?>