Ok,

I am doing something wrong.

Here is the code in the order I have it.
// 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 ($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;
}
}

I have it starting at line 500 of the ot_coupon.php.

Is this right?

Please I am sorry, but I think I need to know what line it should be inserted at.