virtuemart coupons issue


  • Default avatar
    edouard    
     14 years ago
    0

    Hello Seyi

    I've seen a bug -I thing- concerning the virtuemart coupon used in conjonction with awo.

    Exemple :
    15€ product
    10% virtuemart coupon (I mean by that, a coupon created through the old vm coupon management screen)

    Checkout screen : discount = 1.5€ : OK
    Shipping screen : discount = 1.5€ : OK (shipping = 6.9€)
    Payment method screen : discount = 2.17€ : KO (payment = by check = +2€)
    Final checkout confirmation screen : discount = 2.17€ : KO

    Sumary :
    Product = +15€
    schipping = +6.9€
    payment = +2€
    Total = 23.9€

    Discount = 2.17€
    --> Should be : 1.5€


    Did I do something wrong ?
    Thanks
    Ed
  • Your avatar
    seyi    
     14 years ago
    0

    So this is a coupon run through virtuemart and not through awocoupon? If that is the case, this would be a bug in virtuemart, as there is no processing through awocoupon in that case.

    From reading the numbers, it does not make sense. Im not sure where the 2.17 comes from. is your product price inclusive of tax?
  • Default avatar
    edouard    
     14 years ago
    0

    Hello Seyi,
    My products are all taxe included.

    The problem seems to come from shipping fees :

    My shipping fees are the sum of 5.9€ (shipping fees) + 1€ (packaging fees)


    I can fin 2,17€ by :

    15*10% + 5,9*10% + (1/1,196)*10%

    where 1/1,196 = packaging fees without taxes ...


    Sounds wierd yes ...


    I checked again, this happens only when awo coupon are installed.

    Do you know what file should be concerned, as I've done lots of tweaks in vm files, maybe the error can be there ...
  • Your avatar
    seyi    
     14 years ago
    0

    I was able to reproduce this. Virtuemart calculations are so convoluted that the only full proof solution I found for this was to pass in the amount to discount into the Virtuemart engjine.

    So here is the fix:
    www/administrator/components/com_awocoupon/assets/virtuemart/ps_coupon_process.php, right before lines 31 and 42 which both have this code
    <?php
    require_once( CLASSPATH 'ps_coupon.php' );
    ?>


    enter this in both places
    <?php
    if( empty( $d['total'])) {
        if(!isset(
    $d['order_subtotal_withtax']) || !isset($d['payment_discount']) ) $totals ps_coupon_process::order_total ($d);
        
    $d['total'] = $d['order_subtotal_withtax']-$d['payment_discount'];
    }
    ?>


    and replace line 699
    <?php
    function order_total ($d) {
    ?>


    with this
    <?php
    function order_total (&$d) {
    ?>


    I believe that will fix it.