Coupon code condition : exclude child product


  • Default avatar
    luc450    
     7 years ago
    0

    Hi,


    I have a simple question about a weird behavior.

    I have some coupon configured to give 100% discount for the firdt product of a certain category in the cart. Everything id working fine, exept that the coupon aslo work for child product that are not in the same category.


    For exemple.

    I have Product 1 in Category A

    I have Product 2 in Category B 

    Product 2 is a child of Product 1

    Th coupon is set to be valid only if a product from Category A is in the cart. But right now, the coupon is valid for Product 2 too, even if it is not in category A. My guess is it's because Product 2 is a child of Product 1 which is in Category A.


    Is there any way to fix that?


    Thanks in advance!

  • Your avatar
    seyi    
     7 years ago
    0

    Hello,

    Yes, that is the behavior, the coupon is valid on child products also.  You can disable this globally by going to awocoupon->configuration, and in the url adding &advanced=1 so it looks like this:

    index.php?option=com_awocoupon&view=config&advanced=1

    Then going to the advanced tab and disabling it.
  • Default avatar
    luc450    
     7 years ago
    0

    Great! Thanks for reply,

    I found the option and I disabled it, but unfortunatly, it dosen't seem to change anything. :(

    Child products are still discounted.

    Any idea?


    Thanks again!

  • Your avatar
    seyi    
     7 years ago
    0

    Just to be sure, you set 'Exclude children products from discount' to 'Yes'?

  • Default avatar
    luc450    
     7 years ago
    0

    Yes, that's right.
  • Your avatar
    seyi    
     7 years ago
    0

    Hello,

    Then there must be something else going on, because I just tested it and it is working fine for me.  Not really sure, would have to look directly at your setup, unless you want to send a bunch of screen shots.  Is it possible to send temp admin access via private message?
  • Default avatar
    luc450    
     7 years ago
    0

    Hi,


    I just sent you admin access in private message.


    Thanks for your help!


    P.S. : I know that the site is not totaly up to date (but close). It is in plan to update everything soon, in case you need to know.

  • Your avatar
    seyi    
     7 years ago
    0

    Thanks for the access.  Ok, I see the problem, upgrading AwoCoupon would not fix it.  It works if you selected an actual product in the coupon.  But if you select a category it still checks the child products.  Here is the fix, need to update a file through ftp:

    in www/administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php around line 750 is this:

    <?php
    </p><p>        $sql 'SELECT virtuemart_category_id AS category_id,virtuemart_product_id AS product_id
                      FROM #__virtuemart_product_categories
                     WHERE virtuemart_product_id IN ('
    .$ids.')';
            $db->setQuery($sql);
            $tmp1 $db->loadObjectList();
    ?>

    Right after that add this:

    <?php
            
    if($this->params->get('disable_coupon_product_children'0) == 1) return $tmp1;
    ?>

    That should fix the problem.


  • Default avatar
    luc450    
     7 years ago
    0

    Hi,


    Sorry fot the delay,

    I tested it and it works!

    Thanks a lot for your help! :)


    Have a nice day.