Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Newsletter yes/no display..


dannel77

Recommended Posts

Posted

Hi,

 

Is there a way I can make the newsletter option choice of the customer display on the order confirmation e-mail sent out?

I have changed the newsletter option to an SMS-notification option instead and I would like to see directly on the order mail if the user has choosed this option or not, as of now I have to go to Admin--customers--edit and read if it says "Subscribed" or "Unsubscribed".

 

Thanks.

Posted

The order confirmation email is sent by page:

catalog/checkout_process.php around Line - 248

// lets start with the email confirmation

 

 

You would need to add a db query to the table 'customers' - 'customers_newsletter'

Then append the value to the $email_order

Lloyd

Posted
The order confirmation email is sent by page:

catalog/checkout_process.php around Line - 248

// lets start with the email confirmation

You would need to add a db query to the table 'customers' - 'customers_newsletter'

Then append the value to the $email_order

 

Thanks. How do I add the db query? I use MySQLadmin.

Posted

No you have to write it on the same page.

$query = tep_db_query("select customers_newsletter from ' . TABLE_CUSTOMERS . ' where customers_id = ' . $customer_id . "'");

$array = tep_db_fetch_array($query);

if ($array['customers_newsletter'] == 1) {

$email_order .= 'Subscribed to newsletter';

}

Lloyd

Posted
No you have to write it on the same page.

$query = tep_db_query("select customers_newsletter from ' . TABLE_CUSTOMERS . ' where customers_id = ' . $customer_id . "'");

$array = tep_db_fetch_array($query);

if ($array['customers_newsletter'] == 1) {

$email_order .= 'Subscribed to newsletter';

}

 

Thanks. But where should I place this text? I have the code from the checkout_process.php below:

 

// lets start with the email confirmation

$email_order = STORE_NAME . "\n" .

EMAIL_SEPARATOR . "\n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .

// EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .

EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

if ($order->info['comments']) {

$email_order .= tep_db_output($order->info['comments']) . "\n\n";

}

$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

EMAIL_SEPARATOR . "\n" .

$products_ordered .

EMAIL_SEPARATOR . "\n";

 

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

}

 

 

if ($order->content_type != 'virtual') {

$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n" .

"\nE-mail: " .$order->customer['email_address']. "\nTelefon: ".$order->customer['telephone']."\n";

}

 

$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $billto, 0, '', "\n") . "\n" .

"\nE-mail: " .$order->customer['email_address']. "\nTelefon: ".$order->customer['telephone']."\n\n";

 

 

if (is_object($$payment)) {

$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .

EMAIL_SEPARATOR . "\n";

$payment_class = $$payment;

$email_order .= $payment_class->title . "\n\n";

if ($payment_class->email_footer) {

$email_order .= $payment_class->email_footer . "\n\n";

}

}

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

Posted

// lets start with the email confirmation

$email_order = STORE_NAME . "\n" .

EMAIL_SEPARATOR . "\n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .

// EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .

EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

if ($order->info['comments']) {

$email_order .= tep_db_output($order->info['comments']) . "\n\n";

}

$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

EMAIL_SEPARATOR . "\n" .

$products_ordered .

EMAIL_SEPARATOR . "\n";

 

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

}

if ($order->content_type != 'virtual') {

$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n" .

"\nE-mail: " .$order->customer['email_address']. "\nTelefon: ".$order->customer['telephone']."\n";

}

 

$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $billto, 0, '', "\n") . "\n" .

"\nE-mail: " .$order->customer['email_address']. "\nTelefon: ".$order->customer['telephone']."\n\n";

 

 

if (is_object($$payment)) {

$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .

EMAIL_SEPARATOR . "\n";

$payment_class = $$payment;

$email_order .= $payment_class->title . "\n\n";

if ($payment_class->email_footer) {

$email_order .= $payment_class->email_footer . "\n\n";

}

}

 

///////////////////////////////////////////////////////////////////////////

$query = tep_db_query("select customers_newsletter from ' . TABLE_CUSTOMERS . ' where customers_id = ' . $customer_id . "'");

$array = tep_db_fetch_array($query);

if ($array['customers_newsletter'] == 1) {

$email_order .= 'Subscribed to newsletter' . "\n\n";

}

///////////////////////////////////////////////////////////////////////////

 

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

 

Should work..

 

You can change the text sent in the email by editing:

'Subscribed to newsletter'

 

Stay between the quotes!

Lloyd

Posted

Thanks for all the help, really appreciate it.

 

However, I get this error message when trying to place an order:

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/d22703/public_html/checkout_process.php on line 267, it should be this line:

 

if ($array['customers_newsletter'] == 1) {

Posted

///////////////////////////////////////////////////////////////////////////

$query = tep_db_query("select customers_newsletter from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");

$array = tep_db_fetch_array($query);

if ($array['customers_newsletter'] == 1) {

$email_order .= 'Subscribed to newsletter' . "\n\n";

}

///////////////////////////////////////////////////////////////////////////

Lloyd

Posted
///////////////////////////////////////////////////////////////////////////

$query = tep_db_query("select customers_newsletter from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");

$array = tep_db_fetch_array($query);

if ($array['customers_newsletter'] == 1) {

$email_order .= 'Subscribed to newsletter' . "\n\n";

}

///////////////////////////////////////////////////////////////////////////

 

Thanks! Now it's working fine :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...