"Remove Coupon" button


  • Default avatar
    angelique_b    
     11 years ago
    0

    I have this hack installed: http://forum.virtuemart.net/index.php?topic=68334.0

    The remove button was working fine when using AWOCoupons Free version. I upgraded to AWOCoupons Pro, which is working fine, however, the Remove Coupon button is no longer appearing. I have checked to be sure all of my hacks are still in place - they are.

    Is there anything I can do to add a "Remove Coupon" button to the cart so that my customers can remove a coupon and add a new one if they wish?

    Thank you.
  • Your avatar
    seyi    
     11 years ago
    0

    Hello,

    Since you are using AwoCopon 1, here is what you need to clean out:

    <?php
            
    unset(    $_SESSION['coupon_id'],
                    
    $_SESSION['coupon_discount'],
                    
    $_SESSION['coupon_awo_enabled'],
                    
    $_SESSION['coupon_awo_shipping_discount'],
                    
    $_SESSION['coupon_redeemed'],
                    
    $_SESSION['coupon_code'],
                    
    $_SESSION['coupon_type'],
                    
    $_SESSION['coupon_awo_productids'],
                    
    $_SESSION['coupon_awo_entered_coupons'],
                    
    $_SESSION['coupon_awo_processed_coupons']
                );
    ?>


    You should add this to the remove coupon function.
  • Default avatar
    abcisme    
     11 years ago
    0

    Thanks, but the button is still not showing up. It must have something to do with /administrator/components/com_virtuemart/html/basket.php

    Here's what I have for coupon discount. I don't understand why the "remove" button is not showing in my basket.....

    /* COUPON DISCOUNT */
        if( PSHOP_COUPONS_ENABLE=='1' && @$_SESSION['coupon_redeemed']=="1" && PAYMENT_DISCOUNT_BEFORE != '1') {
            $discount_after=true;
            $total -= $_SESSION['coupon_discount'];
            $coupon_display = "- ".$GLOBALS['CURRENCY_DISPLAY']->getFullValue( $_SESSION['coupon_discount'] );
            $coupon_display .= '<form action="'.$action_url.'" method="post" name="remove">
                    <input type="hidden" name="option" value="com_virtuemart" />
                    <input type="hidden" name="page" value="'. $page .'" />
                    <input type="hidden" name="Itemid" value="'. $sess->getShopItemid() .'" />
                    <input type="hidden" name="func" value="couponCartRemove" />
                    <input type="hidden" name="product_id" value="'. $_SESSION['cart'][$i]["product_id"] .'" />
                    <input type="hidden" name="description" value="'. $cart[$i]["description"].'" />
                    <input type="submit" name="Remove" title="remove discount" value="remove discount" />
                      </form>';    
            
        }
        else if( PSHOP_COUPONS_ENABLE=='1' && @$_SESSION['coupon_redeemed']=="1" && PAYMENT_DISCOUNT_BEFORE == '1') {
            $discount_after=false;
            $total -= $_SESSION['coupon_discount'];
            $total -= ($_SESSION['coupon_discount'] * $my_taxrate);
            $tax_total += ($_SESSION['coupon_discount'] * $my_taxrate);
            $coupon_display = "- ".$GLOBALS['CURRENCY_DISPLAY']->getFullValue( $_SESSION['coupon_discount'] );
            $coupon_display .= '<form action="'.$action_url.'" method="post" name="remove">
                    <input type="hidden" name="option" value="com_virtuemart" />
                    <input type="hidden" name="page" value="'. $page .'" />
                    <input type="hidden" name="Itemid" value="'. $sess->getShopItemid() .'" />
                    <input type="hidden" name="func" value="couponCartRemove" />
                    <input type="hidden" name="product_id" value="'. $_SESSION['cart'][$i]["product_id"] .'" />
                    <input type="hidden" name="description" value="'. $cart[$i]["description"].'" />
                    <input type="submit" name="Remove" title="remove discount" value="remove discount" />
                    </form>';    
            
        }
  • Your avatar
    seyi    
     11 years ago
    0

    Yes, I misread the question.

    AwoCoupon also uses the $coupon_display variable. Search for "# awocoupon_code END" on that page and add the code after it.
  • Default avatar
    abcisme    
     11 years ago
    0

    Ah! Figured it out. Thank you for your help. Here's what I did:

        # awocoupon_code START ===============================================================
        if($discount_before || $discount_after) {
            $val = $_SESSION['coupon_discount'] + @$_SESSION['coupon_awo_shipping_discount'];
            $coupon_display = "- ".$GLOBALS['CURRENCY_DISPLAY']->getFullValue( $val );
            $coupon_display .= '<form action="'.$action_url.'" method="post" name="remove">
                    <input type="hidden" name="option" value="com_virtuemart" />
                    <input type="hidden" name="page" value="'. $page .'" />
                    <input type="hidden" name="Itemid" value="'. $sess->getShopItemid() .'" />
                    <input type="hidden" name="func" value="couponCartRemove" />
                    <input type="hidden" name="product_id" value="'. $_SESSION['cart'][$i]["product_id"] .'" />
                    <input type="hidden" name="description" value="'. $cart[$i]["description"].'" />
                    <input type="submit" name="Remove" title="remove discount" value="remove discount" />
                    </form>';    
            if(empty($val)) $discount_before = $discount_after = false;
            if(!empty($_SESSION['coupon_awo_shipping_discount'])) $shipping_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($shipping_total + $_SESSION['coupon_awo_shipping_discount']);    
        }
        # awocoupon_code END =================================================================