Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

order confirmation email


nikikelly

Recommended Posts

Posted

THe email that is sent out after an order is placed detailing billing/shipping/invoice link etc......how can i add text to the beginning of that email?

Posted

I believe you're looking for the code in checkout_process.php

 

In "vanilla" osC, the code is this:

 

// 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";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $order->info['payment_method'] . "\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);

If I've guessed correctly, the question becomes what do you want to add, and where?

:unsure:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted

Add your code BEFORE this line:

 

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

Your code should be something like this:

 

  $email_order .= 'Type your text here. To start a new line use this code (the slash n) > . "\n" . If you use words like can\'t be sure to put the slash in front of the single tick mark' . "\n";

MAKE A BACKUP OF YOUR FILE BEFORE MAKING ANY EDITS!!!

 

If you know what you want to say, and don't mind posting it, I'll help if you want.

:)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted

Thank you for enrolling. Please be sure to add us to your email address book so that you are certain to receive our email communications. Call or email me with any questions or comments you have regarding your service using the contact information below.

 

Best Regards,

 

Kathie Hardy

Customer Service Manager

Phone: 877-123-1234 (M-F 9-5 Eastern)

Email: [email protected]

Posted

MAKE A BACKUP BEFORE ATTEMPTING THIS EDIT.

 

Change this code:

 

// 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";
 }

to:

 

// 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";

//
// added 02/24/08
//

$email_order .= 'Thank you for enrolling. Please be sure to add us to your email address book so that you are certain to receive our email communications. Call or email me with any questions or comments you have regarding your service using the contact information below.' . "\n\n" .
'Best Regards,' . "\n\n" .
'Kathie Hardy' . "\n" .
'Customer Service Manager' . "\n" .
'Phone: 877-123-1234 (M-F 9-5 Eastern)' . "\n" .
'Email: [email protected] ' . "\n\n";

//
// end of added code
//

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

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted

Hello,

 

i've also a question about the summary / order confirmation email.

I just want to add the customers telephone number.

How can i realize this?

 

greets

netzessen

so long

Posted

Find this line:

 

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

Insert this code BEFORE it.

 

  $email_order .= 'Telephone: ' . $order->customer['telephone'] . "\n\n";

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted

If you read this post from the beginning, the answer will become obvious to you.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted

Thanks, i've found it. Sorry for daffy questions but where can i find the hole email- confirmation text? (i would like to edit it)

Unfortunately i can't find the text in the respective languages.

Please help me although it's a stupid question....

so long

Posted

It's all defined in /catalog/includes/languages/[iNSERT LANGUAGE HERE]/checkout_process.php

 

This is the english version:

 

<?php
/*
 $Id: checkout_process.php,v 1.26 2002/11/01 04:22:05 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

define('EMAIL_TEXT_SUBJECT', 'Order Process');
define('EMAIL_TEXT_ORDER_NUMBER', 'Order Number:');
define('EMAIL_TEXT_INVOICE_URL', 'Detailed Invoice:');
define('EMAIL_TEXT_DATE_ORDERED', 'Date Ordered:');
define('EMAIL_TEXT_PRODUCTS', 'Products');
define('EMAIL_TEXT_SUBTOTAL', 'Sub-Total:');
define('EMAIL_TEXT_TAX', 'Tax:		');
define('EMAIL_TEXT_SHIPPING', 'Shipping: ');
define('EMAIL_TEXT_TOTAL', 'Total:	');
define('EMAIL_TEXT_DELIVERY_ADDRESS', 'Delivery Address');
define('EMAIL_TEXT_BILLING_ADDRESS', 'Billing Address');
define('EMAIL_TEXT_PAYMENT_METHOD', 'Payment Method');

define('EMAIL_SEPARATOR', '------------------------------------------------------');
define('TEXT_EMAIL_VIA', 'via');

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

  • 8 months later...
Posted
MAKE A BACKUP BEFORE ATTEMPTING THIS EDIT.

 

Change this code:

 

// 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";
 }

to:

 

// 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";

//
// added 02/24/08
//

$email_order .= 'Thank you for enrolling. Please be sure to add us to your email address book so that you are certain to receive our email communications. Call or email me with any questions or comments you have regarding your service using the contact information below.' . "\n\n" .
'Best Regards,' . "\n\n" .
'Kathie Hardy' . "\n" .
'Customer Service Manager' . "\n" .
'Phone: 877-123-1234 (M-F 9-5 Eastern)' . "\n" .
'Email: [email protected] ' . "\n\n";

//
// end of added code
//

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

 

Hi Jim,

i tried to add this exactly as above (but with my own thank you message and details) but it doesnt appear in the confirmation email. it still comes through as usual starting with my store name and then straight into the details. any ideas as to what might be causing it? i do not have paypal IPN installed as when i tried that it corrupted the entire site and i have been too scared to try again!

 

thanks for any help :)

 

jon

  • 6 months later...
Posted

Hi people.

 

I found this topic just now, I was looking for a way to put customers phone and email into the order email. The solution posted here works just in one language (the one that you use in catalog/checkout_process.php). I needed a solution for the 3 languages of my store. I added also a greeting at top of the mail and a reminder at the and. Also the placing of customers comments (if any) went to the bottom of the mail

 

So, I did following (additions to original code are marked with BOF/EOF):

 

1) Find the file catalog/checkout_process.php

// lets start with the email confirmation
 $email_order = STORE_NAME . "\n\n" .
//BOF Multimixer 19.6.09
	  EMAIL_TEXT_GREETING . "\n" .
//EOF Multimixer
			 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";

 $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";
 }
 //BOF Multimixer 19.6.09
 $email_order .= EMAIL_TEXT_CUSTOMER_TELEPHONE . ' ' . $order->customer['telephone'] . "\n";
 $email_order .= EMAIL_TEXT_CUSTOMER_MAIL . ' ' . $order->customer['email_address']. "\n\n";
 // EOF Multimixer


 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n";
 //BOF Multimixer 19.6.09
 $email_order .= EMAIL_TEXT_CUSTOMER_TELEPHONE . ' ' . $order->customer['telephone'] . "\n";
 $email_order .= EMAIL_TEXT_CUSTOMER_MAIL . ' ' . $order->customer['email_address']. "\n\n";
 // EOF Multimixer
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $order->info['payment_method'] . "\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }
 //BOF Multimixer 19.6.09
 if ($order->info['comments']) {
$email_order .= EMAIL_TEXT_CUSTOMER_COMMENT . "\n".
				EMAIL_SEPARATOR . "\n".
				tep_db_output($order->info['comments']) . "\n\n";
 }
  $email_order .= EMAIL_TEXT_SIGNATURE . "\n";
//EOF Multimixer


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

 

2) Find the file catalog/includes/languages/language that you use/checkout_process.php

define('EMAIL_TEXT_SUBJECT', 'Neue Bestellung');
define('EMAIL_TEXT_ORDER_NUMBER', 'Bestellnummer:');
define('EMAIL_TEXT_INVOICE_URL', 'Detailierte Bestellübersicht:');
define('EMAIL_TEXT_DATE_ORDERED', 'Bestelldatum:');
define('EMAIL_TEXT_PRODUCTS', 'Artikel');
define('EMAIL_TEXT_SUBTOTAL', 'Zwischensumme:');
define('EMAIL_TEXT_TAX', 'MwSt.');
define('EMAIL_TEXT_SHIPPING', 'Versandkosten:');
define('EMAIL_TEXT_TOTAL', 'Summe:		');
define('EMAIL_TEXT_DELIVERY_ADDRESS', 'Lieferanschrift');
define('EMAIL_TEXT_BILLING_ADDRESS', 'Rechnungsanschrift');
define('EMAIL_TEXT_PAYMENT_METHOD', 'Zahlungsweise');
//BOF Multimixer 19.6.09
define('EMAIL_TEXT_CUSTOMER_TELEPHONE', 'Telephon:');
define('EMAIL_TEXT_CUSTOMER_MAIL', 'email:');
define('EMAIL_TEXT_GREETING', 'Danke daß Sie Aquamed fűr Ihre Einkäufe wählten. In dierer email haben Sie einen Űberblick aller Informationen ihrer Bestellung. Für weiere Informationen drücken Sie bitte auf den Link "Detailierte Bestellübersicht. ');
define('EMAIL_TEXT_SIGNATURE', 'Bitte löschen Sie diese email nicht, bis Sie unsere Lieferung bekommen haben. Für weitere Informationen oder Fragen bezüglich Ihrer Bestellung antworten Sie bitte auf diese email und schicken Sie keine neue. Diese email enthält nütyliche Informationen für uns die uns eine schnellere Antwort ermöglichen.');
define('EMAIL_TEXT_CUSTOMER_COMMENT', 'Ihre kommentare:');
//EOF Multimixer


define('EMAIL_SEPARATOR', '------------------------------------------------------');
define('TEXT_EMAIL_VIA', 'durch');
?>

 

You can repeat this for all languages that you use n your store

I hope somebody will find this useful.

 

All thanks to Jim who helped me to find a solution for my problem :)

Posted

Thank you! I found it very useful.

 

Just one more thing, on the order confirmation, the first line is 'my store name'. How can I change that to the customer's name?

Posted

Thats easy and a good idea.

 

1) In file catalog/checkout_process.php

 

Change this

$email_order = STORE_NAME . "\n\n" .

 

to this

$email_order .= EMAIL_TEXT_CUSTOMER_GREETING . ' ' . $order->customer['firstname'] . ' ' . $order->customer['lastname'] . "\n\n".

 

2) In file catalog/includes/languages/yourlanguage/checkout_process.php

 

Add before the last ?>

define('EMAIL_TEXT_CUSTOMER_GREETING', 'Dear');

 

Repeat this for all languages hat you use

Posted

Thanks a lot!

 

It's done :)

 

Now I need to do the same for all the others, Process/Delivered/Cancelled... Hopefully, I will figure it out.

Posted
This mails are coming from admin/orders.php, line about 50

 

The text is in admin/includes/languages/yourlanguage/orders.php

 

You can include as many EMAIL_TEXT_WHATEVER you want, just put a "\n" between and then define the text n the language file

 

Thank you again! I will give it a go.

 

I see people refer to line number many times. How do they get the number? Not by counting each line, is it? :rolleyes:

Posted

admin/orders.php,

 

I changed

 

$email = Store_Name

 

to this

 

$email = EMAIL_TEXT_CUSTOMER_GREETING . ' ' . $order->customer['firstname'] . "\n"

 

I also added define('EMAIL_TEXT_CUSTOMER_GREETING', 'Hi'); in admin/includes/languages/yourlanguage/orders.php

 

Order update shows 'Hi' but not the firstname?!?!

Posted

This happens because the file orders.php doesn't know whats the "firstname" is. If you look at checkout_process.php you will find it defined there, but thats useless for the orders.php

 

For this file we need to do following

 

1. In orders.php before the email code starts put

$customers_name = $check_status ['customers_name'];

 

2. Just after that, in the email code (around line 50) put

$email = EMAI_TEXT_CUSTOMER_GREETING . ' ' . $customers_name . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

 

The customers name is here "$customers_name" and it's comming from "$check_status", not from "$order" like in checkout process.php

 

 

Of course you need to define the EMAIL_TEXT_CUSTOMER_GREETING in the admin/includes/languages/yourlanguage/orders.php, but this you did :)

 

Tell me if this brainjump here worked :)

Posted
This happens because the file orders.php doesn't know whats the "firstname" is. If you look at checkout_process.php you will find it defined there, but thats useless for the orders.php

 

For this file we need to do following

 

1. In orders.php before the email code starts put

$customers_name = $check_status ['customers_name'];

 

2. Just after that, in the email code (around line 50) put

$email = EMAI_TEXT_CUSTOMER_GREETING . ' ' . $customers_name . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

 

The customers name is here "$customers_name" and it's comming from "$check_status", not from "$order" like in checkout process.php

 

 

Of course you need to define the EMAIL_TEXT_CUSTOMER_GREETING in the admin/includes/languages/yourlanguage/orders.php, but this you did :)

 

Tell me if this brainjump here worked :)

 

 

mmm.... now it shows

 

EMAI_TEXT_CUSTOMER_GREETING George Zarkadas

 

I want to have 'Hi George' instead :(

 

Thank you!

 

p.s your name is used as an example :)

Posted

:D That was simple enough! - thank you again.

 

What is the code to put 'first name' only? (for example, Hi George)

 

I did try a few codes but, as expected, failed again! :'(

Archived

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

×
×
  • Create New...