create a parent and made it automatic discount, how to prevent it apply 2 times discount if manually coupon code is added?


  • Default avatar
    bc2007    
     3 years ago
    0

    hi

    About VM 2 and Awocoupon Pro with licenced to this particular url.

    I have create a parent couponcode with procestype-option 'apply to all' it has shippingcosts-discount and 15% discount from 3 products or more
    It is made to an automatic discount, because every client has to get this in every normal situation automatic (without manually work for the client)

    But how to prevent it applies the automatic discount too when a client manually adds a coupon code?

    I have to have a solution for this.
    Because otherwise the client gets too much discount ( gets the automatic and manually couponcode both wich is not right in our case)
    He gets 2 times shippingcost discount and 2 times productdiscount

    So if there is a manually added code, the automatic discounts scripts should be off or overwritten.

    Thanks in advance!
    RM
  • Your avatar
    seyi    
     3 years ago
    0

    In awocoupon->configuration, you could set 'enable multiple coupons' to no. This will then take the first coupon entered, whether it be an automatic discount or manual coupon.
  • Default avatar
    bc2007    
     3 years ago
    0

    Hi Seyi,

    I did enable multiple coupons to NO now.
    But its not the whole solution for this.
    Now I have 2 problems coming up:


    1. Because if the automatic coupon is triggered first than the manual adding of a couponcode does not work anymore.
    My couponcode should have a higher priority with this situation.
    How to fix this?

    2. For another situation another manual coupon should give only an extra discount together with the automatic discount.
    Now I have enabled multiple coupons to no, this is not working anymore.
  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    Yes, there are a few problems with that approach.

    To do it from a coding point, you could try this
    in www/administrator/components/com_awocoupon/helpers/estore/estorecouponhandler.php, around line 248 or so is this
    <?php
            
    if(!empty($auto_code))  { 
                unset(
    $coupon_rows[$auto_code->id]);
                
    array_unshift($coupon_rows,$auto_code); 
            }
    ?>


    change it to this
    <?php
            
    if(!empty($auto_code))  { 
                unset(
    $coupon_rows[$auto_code->id]);
                if(
    count($coupon_rows)==0array_unshift($coupon_rows,$auto_code); 
            }
    ?>


    See if that does it. Note, I did not test the code.
  • Default avatar
    bc2007    
     3 years ago
    0

    Hi,

    I have searched the file, but really cannot find what you describe around line 248.
    Can you please do this for me and also check if it will work.
    I also do not know if I have to set configuration to multiple coupons or not..
    Thanks!
    Bye R
  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    If you want to pay for the customization, then yes I can do it and test and verify it works. Otherwise, I can just give advice. If you do not find it on line 248, verify you are looking at the right file and try using the search function to look for keywords to find the lines.
  • Default avatar
    bc2007    
     3 years ago
    0

    Hello Seyi,

    But what is strange about my wishes with the component? Am I really the only one who wants this combination of discounts?
    I thought it would be no problem to do such discounts with the component wich is not too cheap
    What are your costs to do the job for this in this case?

    Otherwise I really do not have the lines around line 248 like you said. So I cannot try your advice to get it work.

    What do you think?

    greetz Renate
  • Your avatar
    seyi    
     3 years ago
    0

    It is not so strange, It is just not possible to satisfy every customers needs 100% with one solution. This is where customization's come into play. You can contact me privately by email or private message if you want to go the customization route.

    As for the line, forget the line number, just search the file for the specific code. (ctrl-f usually brings up the search function in windows based computers).
  • Default avatar
    bc2007    
     3 years ago
    0

    I did search that way already the first time.
    But ok I send you pm
  • Your avatar
    seyi    
     3 years ago
    0

    please email me a copy of your estorecouponhandler.php file.