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:
// 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');
}
}
[B] // 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
[/B]
} 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!]
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!