Execute("select * from " . TABLE_COUPONS . " where coupon_id = '" . $coupon_id . "'");
$coupon_desc = $db->Execute("select coupon_description from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . $_SESSION['languages_id'] . "'");
// $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id ."', '0', 'Admin', '" . $email_address . "', now() )");
// if on, add in Discount Coupon explanation
$email_text .= "\n" . EMAIL_COUPON_INCENTIVE_HEADER .
(!empty($coupon_desc->fields['coupon_description']) ? $coupon_desc->fields['coupon_description'] . "\n\n" : '') .
strip_tags(sprintf(EMAIL_COUPON_REDEEM, ' ' . $coupon->fields['coupon_code'])) . EMAIL_SEPARATOR ;
$html_msg['COUPON_TEXT_VOUCHER_IS'] = EMAIL_COUPON_INCENTIVE_HEADER ;
$html_msg['COUPON_DESCRIPTION'] = (!empty($coupon_desc->fields['coupon_description']) ? '' . $coupon_desc->fields['coupon_description'] . '' : '');
$html_msg['COUPON_TEXT_TO_REDEEM'] = str_replace("\n", '', sprintf(EMAIL_COUPON_REDEEM, ''));
$html_msg['COUPON_CODE'] = $coupon->fields['coupon_code'];
}
if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
$coupon_code = 'ABCDEF';
// $insert_query = $db->Execute("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
// $insert_id = $db->Insert_ID();
// $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $email_address . "', now() )");
// if on, add in GV explanation
$email_text .= "\n\n" . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) .
sprintf(EMAIL_GV_REDEEM, $coupon_code) .
EMAIL_GV_LINK . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . "\n\n" .
EMAIL_GV_LINK_OTHER . EMAIL_SEPARATOR;
$html_msg['GV_WORTH'] = str_replace('\n','',sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) );
$html_msg['GV_REDEEM'] = str_replace('\n','',str_replace('\n\n','
',sprintf(EMAIL_GV_REDEEM, '' . $coupon_code . '')));
$html_msg['GV_CODE_NUM'] = $coupon_code;
$html_msg['GV_CODE_URL'] = str_replace('\n','',EMAIL_GV_LINK . '' . TEXT_GV_NAME . ': ' . $coupon_code . '');
$html_msg['GV_LINK_OTHER'] = EMAIL_GV_LINK_OTHER;
}
// add in regular email welcome text
$email_text .= "\n\n" . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_GV_CLOSURE;
$html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\n','',EMAIL_TEXT);
$html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\n','',EMAIL_CONTACT);
$html_msg['EMAIL_CLOSURE'] = nl2br(EMAIL_GV_CLOSURE);
// include create-account-specific disclaimer
$email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS). "\n\n";
$html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, ''. STORE_OWNER_EMAIL_ADDRESS .' ');
$html_msg['EMAIL_TO_NAME'] = $name;
$html_msg['EMAIL_TO_ADDRESS'] = $email_address;
$html_msg['EMAIL_SUBJECT'] = $EMAIL_SUBJECT;
$html_msg['EMAIL_FROM_NAME'] = $STORE_NAME;
$html_msg['EMAIL_FROM_ADDRESS'] = $EMAIL_FROM;
$extra_info=email_collect_extra_info(STORE_NAME, EMAIL_FROM, $name, $email_address );
$html_msg['EXTRA_INFO'] = $extra_info['HTML'];
$email_html = zen_build_html_email_from_template('welcome_extra', $html_msg);
// zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'welcome');
?>
>