use all copons, but apply only the coupon with the highest value (productbased not chartbased!)


  • Default avatar
    daniel45    
     2 years ago
    0

    When i had for example:
    Product 1 Category 1 Manufacture 1 Price 100$
    Product 2 Category 1 Manufacture 1 Price 100$
    Product 3 Category 2 Manufacture 1 Price 100$
    Product 4 Category 2 Manufacture 2 Price 100$

    a Coupon 20% Discount for all Category 1 Products
    a Coupon 10% Discount for all Manufacture 1 Products
    a Coupon 50% Discount for Product 1
    a Parent Coupon that include all 3 coupons above

    i add all 4 Products to the chart, and use the Parent Couponcode:
    would it be possible to configure AwoCoupon that it apply only one Discount per Product, the highest possible.
    Productbased would that be:
    Product 1 50$ (50$ Discount)
    Product 2 80$ (20$ Discount)
    Product 3 90$ (10$ Discount)
    Product 4 100$ (no Discount)
    a Discount of Total 80$

    for now it looks like i can set it to:(first,lowest,highest,all)
    80$,80$,100$,100$ // 90$,90$,90$,100$ // 50$,100$,100$,100$ // 36$,72$,90$,100$
    and all of this i dont want to use. is there a way to get what i wish?

    hope what i wrote is understandable, else just ask and i try to explain better.

    Best Regards
    Daniel
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    Although not officially supported you can have coupons applied once max per product. It will apply to all multiple coupon codes, not just the parent coupon code you create. If you are using the latest version, AwoCoupon 2.2/6, go to www/administrator/components/com_awocoupon/helpers/estore/estorecouponhandler.php, around line 624 is this

    <?php
            
    /* # stop product from being discounted more than once in the cart
            foreach($coupon_row->cart_items as $k=>$a) {
                if(!empty($a['totaldiscount'])) unset($coupon_row->cart_items[$k]);
            }
            if(empty($coupon_row->cart_items)) return;
            */
    ?>


    Now uncomment it like this:

    <?php
            
    # stop product from being discounted more than once in the cart
            
    foreach($coupon_row->cart_items as $k=>$a) {
                if(!empty(
    $a['totaldiscount'])) unset($coupon_row->cart_items[$k]);
            }
            if(empty(
    $coupon_row->cart_items)) return;
            
    ?>


    And that should do it.

    The code discounts based on the order of the coupon entered. So if you want the max discount per product, then order your coupons in the parent coupon with the highest value first. So:

    1: Coupon 50% Discount for Product 1
    2: Coupon 20% Discount for all Category 1 Products
    3: Coupon 10% Discount for all Manufacture 1 Products
    3: Coupon 10% Discount for all Manufacture 1 Products
  • Default avatar
    daniel45    
     2 years ago
    0

    Thank you seyi.
    works now like expect.

    hope for a future version, where that will be a standard dropdown choose option inside bakend config.
    so there is no need to change corefile anymore, and hope ordering will be not relevant too.

    beside that it is not a core function yet, issue is solved for me.