Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2015
    Location
    Pennsylvania, USA
    Posts
    21
    Plugin Contributions
    0

    Default Applying dollar amount to quantities of 2

    Hello,

    I have a client that wants to run a $1 off 2 packages of cookies. I have created the coupon and set the minimum order amount to the total of 2 packages of cookies ($13.90). I have restricted all categories and products this would not be applied to.

    I am testing the coupon to see if it works with a client ordering 2, 3, 4, or any combination of packages. It is applying the discount correctly if I order 2, 4, 6, and so forth. However, it is applying a discount of $.50 to single packages as well. Example, I ordered 5 cookies and the discount is showing as $2.50.

    Is there any way to prevent this discount from being applied to a single package in the scenarios I mentioned above?

    Thank you.

  2. #2
    Join Date
    Apr 2015
    Location
    Pennsylvania, USA
    Posts
    21
    Plugin Contributions
    0

    Default Re: Applying dollar amount to quantities of 2

    UPDATE: I misunderstood my client. This is not how she wants to use the coupon. My apologies. The question may come up in the future so if anyone wants to answer that would be great.

    COUPON: My clients wants to have $1 off applied to the first 2 packages ordered, period. They they order 3, 4, 5 and so forth, only $1 gets deducted. Any ideas on how to make that work?

    Here is the ironic part: On the old coupon code it would work that way if I used dollar amount instead of percentage amount. Since the code was fixed it now applies the discount universally using dollar amount or percentages.

    Thank you in advance, and my apologies for the confusion.

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

    Default Re: Applying dollar amount to quantities of 2

    So now you want that Discount Coupon to be $1 or $2 but not increase to over the $2, correct?
    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!

  4. #4
    Join Date
    Apr 2015
    Location
    Pennsylvania, USA
    Posts
    21
    Plugin Contributions
    0

    Default Re: Applying dollar amount to quantities of 2

    No. My apologies for the confusion.

    The client wants the coupon to be applied to the first 2 qualifying packages purchased. So if 3 or more are ordered, only $1.00 will be deducted from the order.

    The offer is $1 off 2 packages.

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

    Default Re: Applying dollar amount to quantities of 2

    Have you an URL to the Category of Products that this Discount Coupon is for?

    Are ALL Products in the Category qualifying Products?
    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!

  6. #6
    Join Date
    Apr 2015
    Location
    Pennsylvania, USA
    Posts
    21
    Plugin Contributions
    0

    Default Re: Applying dollar amount to quantities of 2

    http://glutenfreepizzelles.com/pizze...23b504c911cd57

    No all products in that category are eligible for the coupon.

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

    Default Re: Applying dollar amount to quantities of 2

    To make it so this one Discount Coupon will work when there are 2 or more Products from this 1 category in the cart, you could make the following customizations ...

    Add a new file:
    /includes/functions/extra_functions/functions_coupon_check.php

    that contains the code:
    Code:
    <?php
    if (!function_exists('in_cart_product_total_quantity_category')) {
      function in_cart_product_total_quantity_category($category_id) {
        $products = $this->get_products();
    //echo '<pre>'; echo print_r($products); echo '</pre>';
        $in_cart_product_quantity = 0;
        for ($i=0, $n=sizeof($products); $i<$n; $i++) {
          if ($products[$i]['category'] == $category_id) {
            $in_cart_product_quantity += $products[$i]['quantity'];
          }
        } // end FOR loop
        return $in_cart_product_quantity;
      }
    }
    
    if (!function_exists('in_cart_product_total_quantity_category_sub')) {
      function in_cart_product_total_quantity_category_sub($category_id) {
        $chk_cart_quantity = 0;
        if (zen_has_category_subcategories($category_id)) {
          $subcategories_array = array();
          $chk_cat = $category_id; // parent categories_id
          zen_get_subcategories($subcategories_array, $chk_cat);
          for ($i=0, $n=sizeof($subcategories_array); $i<$n; $i++ ) {
            $chk_cart_quantity += in_cart_product_total_quantity_category($subcategories_array[$i]);
          }
        } else {
          $chk_cart_quantity = in_cart_product_total_quantity_category($category_id);
        }
        return $chk_cart_quantity;
      }
    }
    These funtions are used to count how many Products are in a cart from a Category ...

    Then, edit a clean copy of:
    /includes/modules/order_total/ot_coupon.php

    and add the code in RED around line 212:
    Code:
    // bof: coupon COOKIES on 2 Products
    if ($dc_check == 'COOKIES') {
      $cookies_cat_id = 67;
      $chk_cookies_count = in_cart_product_total_quantity_category_sub($cookies_cat_id);
      if ($chk_cookies_count < 2) {
        $foundvalid = false;
      }
    }
    // eof: coupon COOKIES on 2 Products
    
            if (!$foundvalid) {
              $this->clear_posts();
            }
    Set this line:
    Code:
      $cookies_cat_id = 67;
    
    to be the categories_id for the COOKIE category that you want for this Discount Code ...

    Then, set the Discount Coupon code on this line:
    Code:
    if ($dc_check == 'COOKIES') {
    
    to match your Discount Coupon code for this coupon so that the test runs only for this Discount Coupon to make sure that there are at least quantity 2 of the Cookie Products in the Cart, before it will give the $1.00 Discount ...
    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!

 

 

Similar Threads

  1. v153 shipping based solely on dollar amount???
    By jpmill in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 23 Oct 2014, 07:01 AM
  2. Percentage of Total Amount or Dollar Value
    By anshin in forum Built-in Shipping and Payment Modules
    Replies: 12
    Last Post: 16 Nov 2010, 03:02 PM
  3. Free TShirt with certain dollar amount
    By creativeone in forum General Questions
    Replies: 3
    Last Post: 9 Jul 2009, 10:11 PM
  4. Attribute by percentage versus dollar amount
    By discountvials in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 20 Aug 2007, 07:54 AM

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