Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Placing Customer Name in Order Process Email


zalik22

Recommended Posts

Posted

When I send an order, it says my store name at the beginning of the email. Is there a way I can put the customer's name followed by a comma? I know you have to change the catalog\checkout_process.php file ("$email_order = STORE_NAME . "\n" . ") to something else. I want it to look like this:

 

John Doe,

 

Congratulations! You have just made a purchase! Thank you for your order!

------------------------------------------------------

Order Number: 9

Detailed Invoice: https://www.website.com/catalog/account_his....php?order_id=9

Date Ordered: Monday 13 February, 2006

 

I would like all outgoing emails to the customer (invoice/order confirmation, change in order status emails (pending, processing, delivered etc.) to begin with the customer first and last name followed by a comma, and a blank line. Anybody know how to do this?

 

Thanks!

Posted

Hi

 

try this:

 

// lets start with the email confirmation
 $email_order = $order->customer['firstname'] . ' ' . $order->customer['lastname'] . ',' . "\n\n" . 
			 'Congratulations! You have just made a purchase! Thank you for your order!' . "\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";

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted
Hi

 

try this:

 

// lets start with the email confirmation
 $email_order = $order->customer['firstname'] . ' ' . $order->customer['lastname'] . ',' . "\n\n" . 
			 'Congratulations! You have just made a purchase! Thank you for your order!' . "\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";

 

The code worked if a customer purchases a new product, but not if their status is updated. I'll look around for the update files.

Posted
The code worked if a customer purchases a new product, but not if their status is updated. I'll look around for the update files.

 

I think the code is either in admin\orders.php or admin\order_status.php but I have no clue what to edit. Any ideas anybody?

Posted
I think the code is either in admin\orders.php or admin\order_status.php but I have no clue what to edit. Any ideas anybody?

 

line 50 in admin/orders.php ...

 

just replace the store_name part with what I have before the separator, then edit for the name to be $check_status['customers_name']

 

I thought with the first code you'd be able to adjust the admin one ...

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted
line 50 in admin/orders.php ...

 

just replace the store_name part with what I have before the separator, then edit for the name to be $check_status['customers_name']

 

I thought with the first code you'd be able to adjust the admin one ...

 

I changed the

 $email = STORE_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]);

 

to:

 

$email = $order->customer['firstname'] . ' ' . $order->customer['lastname'] . ',' . "\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['customers_name']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

 

Now I get a comma instead of customer first name last name then "comma."

Posted

Got it, changed it to:

 

 $email = $check_status['customers_name'] . ',' . "\n\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]);

 

Once again, THANKS MONIKA!!! I appreciate your time and patience.

  • 10 months later...
Posted

Hi,

I'm trying to do almost the same thing, except I need to have the delivery name and/or company listed in the order status emails. I have no idea what or how to pull the correct field into this code though! I've tried using the code below and changing ['customers_name'] to ['delivery_name'] but that do anything.

 

Obviously, I'm lost when it comes to trying to figure out what's what with this!

 

Help is appreciated please!

 

Thanks,

Gayla

 

 

Got it, changed it to:

 

 $email = $check_status['customers_name'] . ',' . "\n\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]);

 

Once again, THANKS MONIKA!!! I appreciate your time and patience.

Posted

I am also trying the same thing. I am looking for the company name. It is found in the same table under customers_company I have changed the line to:

. $check_status['customers_company'] . ',' . "\n" .

and I get nothing but a comma. It works fine if I leave the original customers_name but nothing when I make the change. Is there something simple i am missing?

Posted

okay I got it.

Around line 37

 

$check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'" );

 

You have to add your customer_company to this query. It would be:

 

$check_status_query = tep_db_query("select customers_name, customers_company, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'" );

 

Then when you add it to your email command later around line 50 (like I have been trying) it will load.

 

Always something simple.

Posted
okay I got it.

Around line 37

 

$check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'" );

 

You have to add your customer_company to this query. It would be:

 

$check_status_query = tep_db_query("select customers_name, customers_company, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'" );

 

Then when you add it to your email command later around line 50 (like I have been trying) it will load.

 

Always something simple.

 

 

OK so I tried to fix mine using your info as kind of a guide.

 

First I tried to add "delivery_name" to the query -

 

-----------------------

$check_status_query = tep_db_query("select customers_name, delivery_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

-----------------------

 

Then I tried to add the delivery name to the email by changing this info-

 

-----------------------

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . $orders['delivery_name'] . ' ' . 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]);

-----------------------

 

But now, in the order status email, I have an extra blank space in front of the order number but nothing else has changed. No delivery name.

 

I know that I'm totally doing this wrong because I have no idea how to do it, I'm just trying different things to see what happens. LOL

 

Any ideas?

Posted

You will have to use the actual name of the field in your database. For company name mine was customer_company. To find yours you will need to open the database through phpmyadmin and look at the orders table. It should be pretty obvious from there.

Take the field name that you want to include and follow the guide by editing line 37 then 50.

Posted
You will have to use the actual name of the field in your database. For company name mine was customer_company. To find yours you will need to open the database through phpmyadmin and look at the orders table. It should be pretty obvious from there.

Take the field name that you want to include and follow the guide by editing line 37 then 50.

 

Thank you! I will try that and see what happens.

Posted

One more note. I just got it installed in the checkout_process.php.

The code there was:

 

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

'Congratulations! You have just made a purchase! Thank you for your order!' . "\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";

 

 

I added the company_name:

 

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

'Congratulations! You have just made a purchase! Thank you for your order!' . "\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";

 

Glad to have that done. Now the office wants to know if I can get it into the subject line if anyone has any thoughts.

Posted

When I looked in the orders table in my database, the delivery name field shows as delivery_name. This is what I added to both lines 37 and 50, or tried at least. Still no luck.

 

My code looks like this -

 

Line 37

$check_status_query = tep_db_query("select customers_name, delivery_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

 

 

Line 50

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . $orders['delivery_name'] . ' ' . 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]);

 

 

I'm sure I have the syntax wrong somewhere along the way. Can anyone help with this please?

 

Thanks,

Gayla

Archived

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

×
×
  • Create New...