Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2011
    Location
    Washington, D.C.
    Posts
    80
    Plugin Contributions
    0

    Default How to create a coupon/discount code for a specific group of email address

    Hello

    I am trying to figure out if Zencart can create a coupon that is specific to a domain name. For example: If I want to offer a coupon to just people who use an email address from only @mil.gov or @au.edu etc.

    Is there a way to do that? I've been reading and trying to find out if I can do that, and I can't come up with an answer...

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

    Default Re: How to create a coupon/discount code for a specific group of email address

    This could be customized to allow ALL coupons to only be valid for various email addresses by editing the file:
    /includes/modules/order_totals/ot_coupon.php

    by adding the code in RED: around line 357:
    Code:
              // remove if fails address validation
              if (!$foundvalid) {
                $messageStack->add_session('checkout_payment', TEXT_REMOVE_REDEEM_COUPON_ZONE, 'caution');
                $this->clear_posts();
                if (!$foundvalid) zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL',true, false));
              } else {
              //      if ($_POST['submit_redeem_coupon_x'] && !$_POST['gv_redeem_code']) zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'credit_class_error_code=' . $this->code . '&credit_class_error=' . urlencode(TEST_NO_REDEEM_CODE), 'SSL', true, false));
                $messageStack->add('checkout', TEXT_VALID_COUPON,'success');
              }
            }
    
            // bof: check customer email address OHIO-USA.COM or MYLINKSTO.COM
            if ($foundvalid) {
              //echo '$order->customer[email_address]: ' . $order->customer['email_address'] . '<br>';
              if (preg_match('#OHIO-USA.COM#i', $order->customer['email_address']) || preg_match('#MYLINKSTO.COM#i', $order->customer['email_address'])) {
                // valid
              } else {
                // not valid
                define('TEXT_INVALID_COUPON_EMAIL', 'Coupon Valid for Customers with emails from OHIO-USA.COM only!');
                $messageStack->add_session('redemptions', TEXT_INVALID_COUPON_EMAIL ,'caution');
                $this->clear_posts();
                zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
              }
            }
            // eof: check customer email address OHIO-USA.COM or MYLINKSTO.COM
    
          } else {
    Just change the email matches to your own ...

    If you want this just for a specific coupon, you would need a bit more customization to reference the specific coupon ...
    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. Exclude a Specific Category from a Particular Discount Coupon Code?
    By limelites in forum Setting Up Specials and SaleMaker
    Replies: 9
    Last Post: 20 Oct 2012, 05:38 PM
  2. Discount Coupon/Code for One Specific Product
    By thegoodlifestore in forum Setting Up Specials and SaleMaker
    Replies: 3
    Last Post: 26 Oct 2009, 01:00 PM
  3. Replies: 4
    Last Post: 5 Jun 2009, 06:49 AM
  4. How to create a coupon/discount code during Checkout?
    By kevinmc3 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 30 Mar 2009, 03:55 AM
  5. Email to a customer group, how to create the group?
    By elishama3 in forum General Questions
    Replies: 2
    Last Post: 1 Aug 2008, 05:08 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