Warning once checkout confirmed


  • Default avatar
    inorvock    
     a year ago
    0

    Hi - once coupon is entered/applied and payment confirmed the page returned is showing the following error:

    Notice: Undefined property: VirtueMartCart::$BTaddress in /home/edgycraf/public_html/administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php on line 772

    with a warning:
    Error
    Coupon code not found. Please try again.

    Please help!
  • Your avatar
    seyi    
     a year ago
    0

    Hello,

    Is the coupon code being applied? Do you see the discount in order details as well as the history of use in AwoCoupon?

    The problem is just the warnings?
  • Default avatar
    inorvock    
     a year ago
    0

    Hi Seyi,

    I've done some more testing and it is working for a standard coupon but not a shipping coupon - although for both types of coupons the following warning pops up:
    Notice: Undefined property: VirtueMartCart::$BTaddress in /home/edgycraf/public_html/administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php on line 771

    A standard coupon is applied and shows fine in history (but shows the above warning). For a shipping coupon, the coupon code is applied successfully on the check out page with confirmation that the coupon was applied. When the page is refreshed or when I change the quantity of the item in the basket and refresh a warning appears that the coupon code is not found and the above warning appears.

    At the same time the coupon is removed from the coupon code field. If I add the coupon once again, it is successfully applied but the refresh or confirm purchase makes it disappear. It is not showing in the history of uses and the free shipping amount isn't applied.

    Thanks,
    Ian.
  • Your avatar
    seyi    
     a year ago
    0

    Hello,

    What version of Virtuemart is this?
  • Default avatar
    inorvock    
     a year ago
    0

    Joomla 3.43 and Virtuemart 3.0.9
  • Your avatar
    seyi    
     a year ago
    0

    Ok thanks.

    So to deal with the warning first. In this file:
    /home/edgycraf/public_html/administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php on line 772

    Change
    <?php
            $names 
    $this->vmcart->BTaddress['fields'];
    ?>


    To
    <?php
            $names 
    = array('virtuemart_state_id'=>array('value'=>''), 'virtuemart_country_id'=>array('value'=>''));
    ?>

  • Your avatar
    seyi    
     a year ago
    0


    And for the shipping problem, in the same file, around line 64 is this:
    <?php
            $instance
    ->inparams $inparams;
    ?>


    Right after that, add this:
    <?php
             
    if(version_compare($instance->vmversion'2.9.8''>=') && !isset($instance->vmcartPrices['salesPriceShipment'])) {
            
    // calculate shipping
                
    if(!class_exists('VirtueMartCart')) require JPATH_ROOT.'/components/com_virtuemart/helpers/cart.php';
                
    $cart VirtueMartCart::getCart();
                if(empty(
    $cart)) return;
                
                
    $orig_coupon $cart->couponCode;
                
    $cart->couponCode '';
                
    $cart->prepareCartData();
                
    $cart->couponCode $orig_coupon;
                
    $instance->vmcart $cart;
                
    $instance->vmcartPrices $cart->cartPrices;
            }
    ?>


    That should fix it.
  • Default avatar
    inorvock    
     a year ago
    0

    Hi Seyi - once again thank you for your prompt reply. I've made the code changes and tested the shipping coupon and it now works correctly.
    Thanks for your help!