Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2006
    Posts
    298
    Plugin Contributions
    0

    Default Disable coupons and group discounts when quantity discount applied?

    We offer quantity discounts when you buy a case of products. We don't want to allow coupons or group discounts on cases. Would anyone be able to help me modify the code so that if a product has a quantity discount applied, coupons and group discounts would not apply?

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Disable coupons and group discounts when quantity discount applied?

    I have the solution on the Discount Coupons that can work for you ...

    Customize the file:
    /includes/modules/order_total/ot_coupon.php

    and add the code in RED:
    Code:
      function get_order_total($couponCode)
      {
        global $order;
        $orderTaxGroups = $order->info['tax_groups'];
        $orderTotalTax = $order->info['tax'];
        $orderTotal = $order->info['total'];
        $products = $_SESSION['cart']->get_products();
        for ($i=0; $i<sizeof($products); $i++) {
    // bof: no discount on Products with Product Discount quantities products_discount_quantity
          global $db;
          $no_discount = false;
          $sql = "SELECT products_id from " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . " WHERE products_id = '" . (int)$products[$i]['id'] . "'";
          $chk_discount = $db->Execute($sql);
          if ($chk_discount->RecordCount() > 0) $no_discount = true;
    //echo 'ot_coupon products_id: ' . (int)$products[$i]['id'] . ' RecordCount(): ' . $chk_discount->RecordCount() . ' Discounted: ' . ($no_discount ? 'YES' : 'NO') . '<br><br>';
          if ($no_discount || !is_product_valid($products[$i]['id'], $couponCode)) {
    // eof: no discount on Products with Product Discount quantities products_discount_quantity
            $products_tax = zen_get_tax_rate($products[$i]['tax_class_id']);
            $productsTaxAmount = (zen_calculate_tax($products[$i]['final_price'], $products_tax))   * $products[$i]['quantity'];
            $orderTotal -= $products[$i]['final_price'] * $products[$i]['quantity'];
            if ($this->include_tax == 'true') {
    For the Group discounts, this is going to be more complicated and if I get time, I will try to workout some kind of solution for that ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jul 2012
    Posts
    346
    Plugin Contributions
    0

    Default Re: Disable coupons and group discounts when quantity discount applied?

    Quote Originally Posted by Ajeh View Post
    I have the solution on the Discount Coupons that can work for you ...

    Customize the file:
    /includes/modules/order_total/ot_coupon.php

    and add the code in RED:
    Code:
      function get_order_total($couponCode)
      {
        global $order;
        $orderTaxGroups = $order->info['tax_groups'];
        $orderTotalTax = $order->info['tax'];
        $orderTotal = $order->info['total'];
        $products = $_SESSION['cart']->get_products();
        for ($i=0; $i<sizeof($products); $i++) {
    // bof: no discount on Products with Product Discount quantities products_discount_quantity
          global $db;
          $no_discount = false;
          $sql = "SELECT products_id from " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . " WHERE products_id = '" . (int)$products[$i]['id'] . "'";
          $chk_discount = $db->Execute($sql);
          if ($chk_discount->RecordCount() > 0) $no_discount = true;
    //echo 'ot_coupon products_id: ' . (int)$products[$i]['id'] . ' RecordCount(): ' . $chk_discount->RecordCount() . ' Discounted: ' . ($no_discount ? 'YES' : 'NO') . '<br><br>';
          if ($no_discount || !is_product_valid($products[$i]['id'], $couponCode)) {
    // eof: no discount on Products with Product Discount quantities products_discount_quantity
            $products_tax = zen_get_tax_rate($products[$i]['tax_class_id']);
            $productsTaxAmount = (zen_calculate_tax($products[$i]['final_price'], $products_tax))   * $products[$i]['quantity'];
            $orderTotal -= $products[$i]['final_price'] * $products[$i]['quantity'];
            if ($this->include_tax == 'true') {
    For the Group discounts, this is going to be more complicated and if I get time, I will try to workout some kind of solution for that ...
    will this also apply to Swguy quantity discount module?

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Disable coupons and group discounts when quantity discount applied?

    I am afraid that you'd have to ask swguy on that one ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Jul 2012
    Posts
    346
    Plugin Contributions
    0

    Default Re: Disable coupons and group discounts when quantity discount applied?

    I have asked him few times but did not get answer yet. I will post here if find solution.

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,625
    Plugin Contributions
    123

    Default Re: Disable coupons and group discounts when quantity discount applied?

    The answer is no.

    BTW, asking me a question, getting an answer, and then asking a completely different question and waiting less than 24 hours actually doesn't constitute "asking him a few times and not getting an answer."
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  7. #7
    Join Date
    Jul 2012
    Posts
    346
    Plugin Contributions
    0

    Default Re: Disable coupons and group discounts when quantity discount applied?

    Quote Originally Posted by swguy View Post
    The answer is no.

    BTW, asking me a question, getting an answer, and then asking a completely different question and waiting less than 24 hours actually doesn't constitute "asking him a few times and not getting an answer."
    I have included same question in PM, email and other forum post as I am still looking to restrict customers to use / get only 1 discount of your module not all. I have replied to your PM explaining question again.

  8. #8
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,625
    Plugin Contributions
    123

    Default Re: Disable coupons and group discounts when quantity discount applied?

    So your question is really "can the discounts know about each other so they can know not to apply to the same item?" The answer is no; they don't know about each other. Most have specific item exclusion user exits that you can add products to by hand, but each discount is individual and is not aware of the operation of other discounts.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. v154 Group Pricing Discount and Discount Coupons show on checkout, paypal/eway charge full
    By edvon in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 5
    Last Post: 22 Sep 2015, 02:27 PM
  2. v150 disable the free shipping when discount coupons are used.
    By hotspotairsoft.com in forum Customization from the Admin
    Replies: 6
    Last Post: 22 Jun 2012, 03:34 PM
  3. Order Total wrong when Group Discount Applied
    By Brent in forum General Questions
    Replies: 4
    Last Post: 16 Jan 2011, 02:59 AM
  4. Quantity discount is applied when Qty Min/Unit Mix: OFF
    By Techiant in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 2 Dec 2009, 08:22 PM
  5. When is the group discount gets applied to the total?
    By yellow1912 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 0
    Last Post: 21 Sep 2008, 06:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR