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 ...
Bookmarks