Coupon incorrect


  • Default avatar
    jgodek    
     13 years ago
    0

    I think i have a problem with some orders. I had to really dig around but does anyone else have this same issue:

    I kept getting different coupon discounts for the same order.
    What I found is if you buy a product - 1 instance of. The coupon discounts correct. Then I change the total to 2 instances of that product by clicking in the field box of the check out screen, and refreshing the total quantity, the coupon total seems to multiply by two or something! for example:

    product: £12.77

    coupon discount of 20% = - £2.55

    This is correct.


    Now when I update the quantity
    product Subtotal: £24.54
    Coupon Discount: - £5.79
    Incorrect


    BUT if I choose the same product on a re-login, and choose quantity = 2
    Subtotal: £24.54
    Coupon Discount: - £4.91
    which is correct

    But if I go back and update the quantity to 1, the coupon code is off, AND when i change it back to 2
    Subtotal: £24.54
    Coupon Discount: - £5.77

    It seems to change, infact each time I refresh it, the coupon changes.
    Any ideas?
  • Your avatar
    seyi    
     13 years ago
    0

    what version of virtuemart is this? What is the tax setup? Would like to try and reproduce it locally.
  • Default avatar
    jgodek    
     13 years ago
    0

    Hi thanks!

    VirtueMart 1.1.3 stable

    European Mode tax
    and the check for 'Subtract payment discount before tax/shipping?' is checked
  • Your avatar
    seyi    
     13 years ago
    0

    also, what version of AwoCoupon is this?
  • Default avatar
    jgodek    
     13 years ago
    0

    Hi there

    it is Version: 1.0.0
  • Your avatar
    seyi    
     13 years ago
    0

    I knew I had seen this problem before. It would help to upgrade your version, otherwise this should help:
    https://awodev.com/forum/awocoupon/help-section/wrong-coupon-value-calculation-when-update-quantity-cart-don
  • Default avatar
    jgodek    
     13 years ago
    0

    so should I upgrade or apply that fix?

    Thank you!
  • Your avatar
    seyi    
     13 years ago
    0

    Thats really up to you. either way would work, but upgrading might fix other bugs that may exist. Here are the release notes for hte free version:
    https://awodev.com/documentation/awocoupon-virtuemart/release-notes
  • Default avatar
    jgodek    
     13 years ago
    0

    hmm ok I upgraded and still the coupon is changing as I try different quantities
  • Your avatar
    seyi    
     13 years ago
    0

    ok, so you upgraded to 1.0.10 and still the same problem? Ok, can you try this:

    in
    www
    /administrator
    /components
    /com_awocoupon
    /assets
    /virtuemart
    /ps_coupon_process.php, around line 47, change

    <?php
    if( empty( $d['total'])) {
    // we need some functions from the checkout module 
        
    require_once( CLASSPATH "ps_checkout.php" );
        
    $checkout = new ps_checkout();
        
    $totals $checkout->calc_order_totals($d);
        
    $d['total'] = $totals['order_subtotal']
                    + 
    $totals['order_tax']
                    + 
    $totals['order_shipping']
                    + 
    $totals['order_shipping_tax']
                    - 
    $totals['payment_discount'];
    }
    ?>


    to this
    <?php
    //if( empty( $d['total'])) {
    // we need some functions from the checkout module 
        
    require_once( CLASSPATH "ps_checkout.php" );
        
    $checkout = new ps_checkout();
        
    $totals $checkout->calc_order_totals($d);
        
    $d['total'] = $totals['order_subtotal']
                    + 
    $totals['order_tax']
                    + 
    $totals['order_shipping']
                    + 
    $totals['order_shipping_tax']
                    - 
    $totals['payment_discount'];
    //}
    ?>
  • Default avatar
    jgodek    
     13 years ago
    0

    Ok that seems to work but now the coupon is coming off the total including the tax. where it should come off the total before tax is added.

    European Mode
    and the box for Subtract tax is checked.
  • Your avatar
    seyi    
     13 years ago
    0

    I see, you can try changing

    <?php
        $d
    ['total'] = $totals['order_subtotal']
                    + 
    $totals['order_tax']
                    + 
    $totals['order_shipping']
                    + 
    $totals['order_shipping_tax']
                    - 
    $totals['payment_discount'];
    ?>


    to this
    <?php
        $d
    ['total'] = $totals['order_subtotal'];
    ?>

  • Default avatar
    jgodek    
     13 years ago
    0

    Ok i think it is working!. Thank you so much