You need to customize the ot_coupon.php module for a few things ...
1 you don't want the input box to show if some products_id is in the cart ...
2 you have to remove the Discount Coupon code if the discount coupon code was added on a valid order ... then the customer continued to shop and added in the invalid products_id ...
In the collect_posts function add the code:
Code:
// bof: hide discount coupon input remove code
global $cart;
$chk_hide = $_SESSION['cart']->in_cart_check('products_id','12');
if ($chk_hide > 0) {
$foundvalid = false;
}
// eof: hide discount coupon input remove code
if (!$foundvalid) {
$this->clear_posts();
}
Change the function credit_selection to read:
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: hide discount coupon input
global $cart;
$chk_hide = $_SESSION['cart']->in_cart_check('products_id','12');
if ($chk_hide > 0) {
// hide the input box
} else {
$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: hide discount coupon input
return $selection;
}