Multiple Gift Certificate Mode only


  • Default avatar
    prashant    
     4 years ago
    0



    We have a Feature called Enable Multiple Coupons in Awocoupon

    but some time we needed to allow Multiple Gift Certificate only
    so that if any customer have Multiple Gift certificate then he can use them, but on other side, if they try to use Multiple Coupon then they face a restriction,

    is there is any hack for this ??
  • Your avatar
    seyi    
     4 years ago
    0

    Hello,

    In AwoCoupon 2, you can try something like this:
    in www/administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php around line 119 is this code:
    <?php
            $coupon_codes 
    implode('","',$coupon_awo_entered_coupon_ids);
    ?>


    Right after that add this:
    <?php
            $number_of_coupon_codes 
    1;
            
    $sql 'SELECT * FROM #__awocoupon WHERE function_type="coupon" AND coupon_code IN ("'.$coupon_codes.'") ORDER BY FIELD(coupon_code, "'.$coupon_codes.'")';
            
    $db->setQuery$sql );
            
    $tests $db->loadObjectList();
            if(
    count($tests)>$number_of_coupon_codes$removecoupons array_slice($tests,0,$number_of_coupon_codes-count($tests));
            if(!empty(
    $removecoupons)) {
                foreach(
    $removecoupons as $r) if(($key array_search($r->coupon_code$coupon_awo_entered_coupon_ids)) !== false) unset($coupon_awo_entered_coupon_ids[$key]);
            }
            
    $coupon_codes implode('","',$coupon_awo_entered_coupon_ids);
    ?>


    Note, this is untested, but should get you in the correct direction.
  • Default avatar
    prashant    
     4 years ago
    0

    just try it,
    its not working
    result is as it is
    when i enable Multiple Coupons mode, it start accepting multiple Coupons also

    n when i disable Multiple Coupons, it start rejecting Multiple gift certificate,
  • Your avatar
    seyi    
     4 years ago
    0

    yes there are some problems with the original code. I updated the post with the code, it should work now.