Hallo,
also es geht sich um das Modul "Newsletter bei Bestellung"
funktioniert auch soweit, nur wird der Kunde bei jeder Bestellung erneut in die Newsletterliste eingetragen (auch wenn er schon drinne steht)
in der checkout_process.php wird durch das Modul folgender Code hinzugefügt:
/checkout_process.phpif ($_POST['newsletter'] != '') { $check_mail_query = xtc_db_query("select customers_email_address, customers_status, customers_firstname, customers_lastname from ".TABLE_CUSTOMERS." where customers_id = '".$_SESSION['customer_id']."'"); if (xtc_db_num_rows($check_mail_query)) { $check_customer = xtc_db_fetch_array($check_mail_query); $customers_id = $check_customer['customers_id']; $customers_status = $check_customer['customers_status']; $customers_firstname = $check_customer['customers_firstname']; $customers_lastname = $check_customer['customers_lastname']; $customers_email_address = $check_customer['customers_email_address']; $vlcode = xtc_random_charcode(32); $link = xtc_href_link(FILENAME_NEWSLETTER, 'action=activate&email='.$customers_email_address.'&key='.$vlcode, 'NONSSL'); // assign language to template for caching $smarty->assign('language', $_SESSION['language']); $smarty->assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/'); $smarty->assign('logo_path', HTTP_SERVER.DIR_WS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/img/'); // assign vars $smarty->assign('EMAIL', $_POST['email']); $smarty->assign('LINK', $link); // dont allow cache $smarty->caching = false; // create mails $html_mail = $smarty->fetch(CURRENT_TEMPLATE.'/mail/'.$_SESSION['language'].'/newsletter_mail.html'); $txt_mail = $smarty->fetch(CURRENT_TEMPLATE.'/mail/'.$_SESSION['language'].'/newsletter_mail.txt'); $check_mail_query = xtc_db_query("select customers_id from ".TABLE_NEWSLETTER_RECIPIENTS." where customers_id = '".$_SESSION['customer_id']."'"); if (!xtc_db_num_rows($check_mail_query)) { $sql_data_array = array ('customers_email_address' => $customers_email_address, 'customers_id' => $customers_id, 'customers_status' => $customers_status, 'customers_firstname' => $customers_firstname, 'customers_lastname' => $customers_lastname, 'mail_status' => '0', 'mail_key' => xtc_db_input($vlcode), 'date_added' => 'now()'); xtc_db_perform(TABLE_NEWSLETTER_RECIPIENTS, $sql_data_array); if (SEND_EMAILS == true) { xtc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $customers_email_address, '', '', EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', TEXT_EMAIL_SUBJECT, $html_mail, $txt_mail); } } else { if (SEND_EMAILS == true) { xtc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $_POST['email'], '', '', EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', TEXT_EMAIL_SUBJECT, $html_mail, $txt_mail); } } } else { }}
wie zu sehen erfolgt leider keine Abfrage, ob bereits ein Newsletter zum Kunden eingerichtet ist.
daher nun mal kurz gedacht... im Newslettersystem vom Shop ist die Abfrage für existierende Abonnenten bereits enthalten...
// Check if email exists
if (($_POST['check'] == 'inp') && ($_POST['vvcode'] == $_SESSION['vvcode'])) {
$check_mail_query = xtc_db_query("select customers_email_address, mail_status from ".TABLE_NEWSLETTER_RECIPIENTS." where customers_email_address = '".xtc_db_input($_POST['email'])."'");
if (!xtc_db_num_rows($check_mail_query)) {
if (isset ($_SESSION['customer_id'])) {
$customers_id = $_SESSION['customer_id'];
$customers_status = $_SESSION['customers_status']['customers_status_id'];
$customers_firstname = $_SESSION['customer_first_name'];
$customers_lastname = $_SESSION['customer_last_name'];
} else {
$check_customer_mail_query = xtc_db_query("select customers_id, customers_status, customers_firstname, customers_lastname, customers_email_address from ".TABLE_CUSTOMERS." where customers_email_address = '".xtc_db_input($_POST['email'])."'");
if (!xtc_db_num_rows($check_customer_mail_query)) {
$customers_id = '0';
$customers_status = '1';
$customers_firstname = TEXT_CUSTOMER_GUEST;
$customers_lastname = '';
} else {
$check_customer = xtc_db_fetch_array($check_customer_mail_query);
$customers_id = $check_customer['customers_id'];
$customers_status = $check_customer['customers_status'];
$customers_firstname = $check_customer['customers_firstname'];
$customers_lastname = $check_customer['customers_lastname'];
}
}
$sql_data_array = array ('customers_email_address' => xtc_db_input($_POST['email']), 'customers_id' => xtc_db_input($customers_id), 'customers_status' => xtc_db_input($customers_status), 'customers_firstname' => xtc_db_input($customers_firstname), 'customers_lastname' => xtc_db_input($customers_lastname), 'mail_status' => '0', 'mail_key' => xtc_db_input($vlcode), 'date_added' => 'now()');
xtc_db_perform(TABLE_NEWSLETTER_RECIPIENTS, $sql_data_array);
$info_message = TEXT_EMAIL_INPUT;
if (SEND_EMAILS == true) {
xtc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, xtc_db_input($_POST['email']), '', '', EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', TEXT_EMAIL_SUBJECT, $html_mail, $txt_mail);
}
} else {
$check_mail = xtc_db_fetch_array($check_mail_query);
if ($check_mail['mail_status'] == '0') {
$info_message = TEXT_EMAIL_EXIST_NO_NEWSLETTER;
if (SEND_EMAILS == true) {
xtc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, xtc_db_input($_POST['email']), '', '', EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', TEXT_EMAIL_SUBJECT, $html_mail, $txt_mail);
}
} else {
$info_message = TEXT_EMAIL_EXIST_NEWSLETTER;
}
}
} else {
$info_message = TEXT_WRONG_CODE;
}
if (($_POST['check'] == 'del') && ($_POST['vvcode'] == $_SESSION['vvcode'])) {
$check_mail_query = xtc_db_query("select customers_email_address from ".TABLE_NEWSLETTER_RECIPIENTS." where customers_email_address = '".xtc_db_input($_POST['email'])."'");
if (!xtc_db_num_rows($check_mail_query)) {
$info_message = TEXT_EMAIL_NOT_EXIST;
} else {
$del_query = xtc_db_query("delete from ".TABLE_NEWSLETTER_RECIPIENTS." where customers_email_address ='".xtc_db_input($_POST['email'])."'");
$info_message = TEXT_EMAIL_DEL;
}
}
}
Alles anzeigen
in der newsletter.php ist also nun die abfrage // Check if email exists vorhanden...
kann mir evtl noch jemand helfen diese // Check if email exists abfrage auch in das Codestück zur Checkout_process einzuarbeiten ?
Ziel ist es, dass wenn der User schon eine newsletter abbo hat, er dann einfach keine neue aktivierungsmail mehr bekommt (auch keine Info) einfach nur keine 2. Mail bei der bestellung.