• Default avatar
    quayfee    
     8 years ago
    0

    I'm not 100% sure if this is Virtuemart or AWOCoupon, but would really appreciate guidance on where to look.

    I am working on an old J1.5 / VM 1.1 / AWO1.0.12 site. The prices are exclusive of VAT. The initial application of a % based coupon works perfectly, however if a product is added to the cart AFTER the coupon has been applied, the coupon calculation is done on the inc VAT price, but then applied to the Ex VAT value. SO in effect an extra 20% is added to the discount.

    The strange thing is that if you then remove a product the VAT calculation is corrected.

    I'm pretty certain it's just that the wrong price element is being used in the function that updates the discount in the 'add product' function, but have no idea where to look to try and find the bug.

    Any ideas or guidance would be gratefully received.


    Thanks

    Keith
  • Your avatar
    seyi    
     8 years ago
    0

    Hello,

    If you are dealing with an overall discount, and the coupon is not just for specific products, then this is the total used:

    in www/administrator/components/com_awocoupon/helpers/vm_coupon.php, around line 43:

    <?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'];
                }
    ?>