Coupon Redemption/uses Problem


  • Default avatar
    mediacore    
     13 years ago
    0

    A Virtuemart website has a number of single use coupons created. The coupons are applying their discount to the order in the checkout correctly, but as far as I can tell the information is not being recorded correctly in the database.

    In the _vm_orders table the coupon code is correctly recorded in the coupon_code column, but in most cases the coupon_discount is being recorded as 0, even though the discount has been deducted from the order. For those orders there is no Coupon Discount row in the order when viewed in the administrator, it is just 'invisibly' deducted between the subtotal and total.

    No entry for the coupon is made in the _awocoupon_user_uses table for orders where the discount is recorded as 0.

    There were some problems in the awo coupon installation check, they have been fixed so that everything shows as installed. Before they were fixed coupons were sometimes redeemed correctly. Fixing them has made no apparent difference.

    Coupons have been created as:
    Function type: coupon
    function type 2: product
    number of uses: total 1

    I can see no difference between a coupon or order that has been redeemed correctly and one that has not.

    Any ideas?

  • Your avatar
    seyi    
     13 years ago
    0

    It cannot be random, something must be causing it. What version of AwoCoupon are you using? I think you should look at the classes/ps_checkout.php file. In function add should be some code like this:
    <?php
            
    // Remove the Coupon, because it is a Gift Coupon and now is used!!
            
    if( @$_SESSION['coupon_type'] == "gift" ) {
                
    $d['coupon_id'] = $_SESSION['coupon_id'];
                include_once( 
    CLASSPATH.'ps_coupon.php' );
                
    ps_coupon::remove_coupon_code$d );
            }
    ?>

    That should be the only executing code for coupons in that function.
  • Default avatar
    mediacore    
     13 years ago
    0

    But I haven't been able to track down a cause.

    I've checked the ps_checkout.php file and it includes the code above.

    Version details
    Joomla 1.5.10
    Virtuemart 1.1.3
    Awo coupon 1.4.0

    As I think I said, initially some coupons were being removed, some were not. More recently there are very few, if any, coupons that are being removed after use.
  • Your avatar
    seyi    
     13 years ago
    0

    Once a coupon is used, is it being entered in Awocoupon->History of Uses?
  • Default avatar
    mediacore    
     13 years ago
    0

    Coupon history is only being recorded when the coupon is being redeemed correctly.

    This seems to directly relate to whether the discount amount is being recorded in the orders table, or just being deducted from the order.
  • Your avatar
    seyi    
     13 years ago
    0

    found that the order is not being added in ps_checkout.php function add, but instead it is added within the payment gateway code:
    administrator/components/com_virtuemart/classes/payment/ps_ewaysharedpage.php

    This code did not call the coupon cleanup function causing the problem.