Coupon value exceeds the total of order


  • Default avatar
    jwwisgerhof    
     14 years ago
    0

    Hi mate,

    I purchased and installed AWOcoupon at www.australianonlinecollege.com.au. It is all working perfectly and I am very happy I went with AWO. However I have one strange problem:

    When a user enters a coupon with a value that is higher then the total order price, the user should (supposedly) not have to enter their payment details as the products would be free. However, this does not seem to work - I still have to enter payment details when the total order amount is $0.00.

    Any ideas?

    Cheers!
  • Your avatar
    seyi    
     14 years ago
    0

    Are you using virtuemart 1.1.4 or 1.1.5?
    In my tests, it works fine in 1.1.4, but in 1.1.5 it does not skip the payment method screen.
  • Your avatar
    seyi    
     14 years ago
    0

    Did some more testing, and I believe it can happen on both 1.1.4 and 1.1.5. It seems to be a rounding issue. When it does the check, sometimes the order total is 0.001523 and that is checked to see if it is 0, obviously it is not. So I would round the order total to 2 decimal places to fix this.

    In www/administrator/components/com_virtuemart/classes/ps_checkout.php, around line 860 change
    <?php
    elseif( isset($order_total) && $order_total <= 0.00 ) {
    ?>


    to

    <?php
    elseif( isset($order_total) && round($order_total,2) <= 0.00 ) {
    ?>


    that should fixe the problem
  • Default avatar
    edouard    
     13 years ago
    0

    Hi Seyi,

    following your great advice once again solved this problem
    but I noticed that when giftcert > total order, total order in checkout = "-0.00EUR"

    Of course it's not a real problem ...

    So I looking deep into ps_checkout file, and noticed an other place where you "round" solution can fit, and this solved this "minus" issue :


    Find
    <?php
            
    if( empty( $_REQUEST['order_total'])) {
                
                if( isset( 
    $d['order_total'])) {
                    if( 
    round$d['order_total'], ) <= 0.00 ) {
                        return 
    true;
                    }
                }
                if( isset(
    $order_total) && $order_total <= 0.00 ) {
                    return 
    true;
                }
            }
    ?>


    And replace by

    <?php
            
    if( empty( $_REQUEST['order_total'])) {
                
                if( isset( 
    $d['order_total'])) {
                    if( 
    round$d['order_total'], ) <= 0.00 ) {
                        return 
    true;
                    }
                }
                if( isset(
    $order_total) && round($order_total,2) <= 0.00 ) {
                    return 
    true;
                }
            }
    ?>


    Does it look right to you ? :)

    Ed
  • Your avatar
    seyi    
     13 years ago
    0

    yes looks fine
  • Default avatar
    anaffelici    
     12 years ago
    0

    Some suggestions to solve this in VM2?

    tks
  • Your avatar
    seyi    
     12 years ago
    0

    I see you already found it but here is the discussion on that topic, for others:
    https://awodev.com/forum/awocoupon/help-section/error-coupon-equal-sales-price
  • Default avatar
    anaffelici    
     12 years ago
    0

    It would be great if the customer doesn't have to choose a payment method and VM set this automatically for Zero orders :/
  • Your avatar
    seyi    
     12 years ago
    0

    You should post that in the virtuemart forum. AwoCoupon has no control over the payment methods.
  • Default avatar
    anaffelici    
     12 years ago
    0

    Sorry seyi,

    Have researched a lot there .... without answers .... I will open a new topic. Thank you for answers, this is the best and fastest support. I feel safe in acquiring the coupons component and some plugins, I'll make the purchase today! ;)