Page 1 of 3 123 LastLast
Results 1 to 10 of 25
  1. #1
    Join Date
    Aug 2011
    Location
    Near Ottawa, Ontario, Canada
    Posts
    321
    Plugin Contributions
    0

    Default Blocking usage of Group Discount & Discount Coupons

    Hi.

    I'd like to prevent ppl from redeeming a discount coupon code when their in a discount group. Is that possible?

  2. #2
    Join Date
    Aug 2011
    Location
    Near Ottawa, Ontario, Canada
    Posts
    321
    Plugin Contributions
    0

    Default Re: Blocking usage of Group Discount & Discount Coupons

    Perhaps some background info would help?

    I'm doign a WagJaw campaign(CDN groupon clone) and I'm selling a membership that will entitle clients to a discount for a year. I was hoping to use group pricing for this but I hadn't realized they could also redeem coupons on top of the group pricing discount. Is there a way to add restrictions to group pricing or perhaps do this another way. Worst case I guess I could give everone a coupon code they they'd have to enter at every purchase that way they could only apply a single discount but that's allot of overhead when I could just have them part of a group.

    Any thoughts?

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

    Default Re: Blocking usage of Group Discount & Discount Coupons

    To stop anyone with a Group Discount from using a Discount Coupon, you could alter the ot_coupon.php module with something like:
    Code:
      function credit_selection() {
        global $discount_coupon;
        // note the placement of the redeem code can be moved within the array on the instructions or the title
    
        // bof: stop discount coupon for anyone in a customer group
        global $db;
        $chk_group = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . "'");
        if ($chk_group->fields['customers_group_pricing'] > 0) {
          $allow_discount = false;
        } else {
          $allow_discount = true;
        }
    
        if ($allow_discount) {
        $selection = array('id' => $this->code,
                           'module' => $this->title,
                           'redeem_instructions' => MODULE_ORDER_TOTAL_COUPON_REDEEM_INSTRUCTIONS . ($discount_coupon->fields['coupon_code'] != '' ? MODULE_ORDER_TOTAL_COUPON_REMOVE_INSTRUCTIONS : '') . ($discount_coupon->fields['coupon_code'] != '' ? MODULE_ORDER_TOTAL_COUPON_TEXT_CURRENT_CODE . '<a href="javascript:couponpopupWindow(\'' . zen_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $_SESSION['cc_id']) . '\')">' . $discount_coupon->fields['coupon_code'] . '</a><br /><br />' : ''),
                           'fields' => array(array('title' => MODULE_ORDER_TOTAL_COUPON_TEXT_ENTER_CODE,
                                                   'field' => zen_draw_input_field('dc_redeem_code', '', 'id="disc-' . $this->code . '" onkeyup="submitFunction(0,0)"'),
                                                   'tag' => 'disc-'.$this->code
                           )));
        }
        // eof: stop discount coupon for anyone in a customer group
    
        return $selection;
      }
    Note: you should include some type of exclusion statement in your Discount Coupons ...
    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
    Aug 2011
    Location
    Near Ottawa, Ontario, Canada
    Posts
    321
    Plugin Contributions
    0

    Default Re: Blocking usage of Group Discount & Discount Coupons

    Much appreciated Ajeh. I'll give that a whirl.

    When you say I should include an exclusion statement, are you referring to the printed/virtual coupon itself or are you refering to code exclusion?

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

    Default Re: Blocking usage of Group Discount & Discount Coupons

    Just a notice such as Discount Coupons not valid with other discounts or something so people do not wonder ...
    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
    Sep 2011
    Posts
    86
    Plugin Contributions
    0

    Default Re: Blocking usage of Group Discount & Discount Coupons

    Hi, I was wondering if I could somehow apply this idea to a coupon I am preparing for a trade show. I want to offer a coupon to all first time users, but I do not want them to be able to use the coupon if they have made a purchase in the past. Let me say first that I am in NO WAY a good coder, so if you have an idea PLEASE explain it to me as if I were a 4 year old.

    Thanks.

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

    Default Re: Blocking usage of Group Discount & Discount Coupons

    You could use this code ... note the line in blue is only needed if not using other IF statements with the same code:
    Code:
        // bof: stop discount coupon for anyone with an order
        $allow_discount = true;
        if ($discount_coupon->fields['coupon_code'] == 'abc123') {
          global $db;
          $chk_group = $db->Execute("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . $_SESSION['customer_id'] . "'");
          if ($chk_group->RecordCount() > 0) {
            $allow_discount = false;
          } else {
            $allow_discount = true;
          }
        }
        // eof: stop discount coupon for anyone with an order
        if ($allow_discount) {
        $selection = array('id' => $this->code,
                           'module' => $this->title,
                           'redeem_instructions' => MODULE_ORDER_TOTAL_COUPON_REDEEM_INSTRUCTIONS . ($discount_coupon->fields['coupon_code'] != '' ? MODULE_ORDER_TOTAL_COUPON_REMOVE_INSTRUCTIONS : ''),
                           'fields' => array(array('title' => ($discount_coupon->fields['coupon_code'] != '' ? MODULE_ORDER_TOTAL_COUPON_TEXT_CURRENT_CODE . '<a href="javascript:couponpopupWindow(\'' . zen_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $_SESSION['cc_id']) . '\')">' . $discount_coupon->fields['coupon_code'] . '</a><br />' : '') . MODULE_ORDER_TOTAL_COUPON_TEXT_ENTER_CODE,
                                                   'field' => zen_draw_input_field('dc_redeem_code', '', 'id="disc-' . $this->code . '" onkeyup="submitFunction(0,0)"'),
                                                   'tag' => 'disc-'.$this->code
                           )));
        }
       // eof: stop discount coupon for anyone with an order
    
    Then you can surround the
    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!

  8. #8
    Join Date
    Sep 2011
    Posts
    86
    Plugin Contributions
    0

    Default Re: Blocking usage of Group Discount & Discount Coupons

    Wow, thanks.

    OK so, I guess I should edit includes/modules/order_total/ot_coupon.php, and NOT includes/languages/english/modules/order_total/ot_coupon.php.

    Also should I add the new code to the top or the bottom of the current code?

    I guess I can make the change to the abc123 coupon right in the code you gave me, and not at the coupon manager.

    If these guess' are correct I will try it tonight and let you know how it worked.

    thanks again.

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

    Default Re: Blocking usage of Group Discount & Discount Coupons

    Actually, if you are going to run both of these IFs together you will need to adjust the code by commenting the line in RED:
    Code:
        if ($discount_coupon->fields['coupon_code'] == 'abc123') {
          global $db;
          $chk_group = $db->Execute("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . $_SESSION['customer_id'] . "'");
          if ($chk_group->RecordCount() > 0) {
            $allow_discount = false;
          } else {
    //        $allow_discount = true;
          }
        }
    Put that code below your other IF code:
    Code:
        // bof: stop discount coupon for anyone in a customer group
        global $db;
        $chk_group = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . "'");
        if ($chk_group->fields['customers_group_pricing'] > 0) {
          $allow_discount = false;
        } else {
          $allow_discount = true;
        }
    Now the new IF won't conflict with the other IF for the customer group ...

    Yes, change the abc123 to your your coupon code you are trying to block if a previous order exists ... and, yes, this is the code file not the language file ...
    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!

  10. #10
    Join Date
    Sep 2011
    Posts
    86
    Plugin Contributions
    0

    Default Re: Blocking usage of Group Discount & Discount Coupons

    Ok,

    So I will put both of the two new pieces of code you sent me from your last post in the code file. I will remove the // before the red code and test using the abc123 and see if it works for me.

    thanks again and sorry for not being very good with the coding.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Disable coupons and group discounts when quantity discount applied?
    By abcisme in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 12 Nov 2015, 12:31 PM
  2. 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
  3. Set max discount for Group Discount + Discount + etc.
    By KEnik in forum Setting Up Specials and SaleMaker
    Replies: 0
    Last Post: 16 Jun 2010, 05:39 PM
  4. Restrict Wholesale or Discount Group users from using coupons
    By BettyBoop28 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 3
    Last Post: 25 Feb 2010, 12:52 AM
  5. Can I restrict Discount Coupons if Group Discount used?
    By mitch_h in forum General Questions
    Replies: 3
    Last Post: 5 Nov 2009, 02:25 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