Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order Number and Status in Update Emails


Guest

Recommended Posts

When a customer replies to your admin-generated order update, and doesn't quote the email you sent, isn't it a pain to find the order? If you've installed PWA, which lets them checkout without creating an account, you may even have to look in the database to find which order they're referring to. All you have is their email address, and the fact that you've emailed them.

 

Well, folks, those worries are a thing of the past! phpMyAdmin will no longer be required to find orders! Step right up, sit yourself down, and prepare to be astonished!

 

Ok, I've had about enough of that. Let's get to it. We're going to changes the email subject line of all your admin-generated order status updates (except the original purchase email) from this: Order Update to this: Your Great Store Order 1234: Shipped. The email title will now have the order number (handy for when you get non-quoted replies) and the order status (more obvious for the customer).

 

Only 2 file edits are required:

  • catalog/admin/orders.php
  • catalog/admin/includes/languages/english/orders.php (obviously you can also do this in other languages)

Step 1: catalog/admin/orders.php

Find this:

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

           tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

           $customer_notified = '1';

 

Change it to this:

            $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\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

           tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT_1. $oID . EMAIL_TEXT_SUBJECT_2 . $orders_status_array[$status], $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

           $customer_notified = '1';

 

 

Step 2: catalog/admin/includes/languages/english/orders.php

Find this:

define('EMAIL_SEPARATOR', '------------------------------------------------------');
define('EMAIL_TEXT_SUBJECT', 'Order Update');
define('EMAIL_TEXT_ORDER_NUMBER', 'Order Number:');
define('EMAIL_TEXT_INVOICE_URL', 'Detailed Invoice:');
define('EMAIL_TEXT_DATE_ORDERED', 'Date Ordered:');
define('EMAIL_TEXT_STATUS_UPDATE', 'Your order has been updated to the following status.' . "\n\n" . 'New status: %s' . "\n\n" . 'Please reply to this email if you have any questions.' . "\n");
define('EMAIL_TEXT_COMMENTS_UPDATE', 'The comments for your order are' . "\n\n%s\n\n");

 

Change it to something like this:

define('EMAIL_SEPARATOR', '------------------------------------------------------');
define('EMAIL_TEXT_SUBJECT_1', 'Your Great Store Order ');
define('EMAIL_TEXT_SUBJECT_2', ':  ');
define('EMAIL_TEXT_ORDER_NUMBER', 'Order Number:');
define('EMAIL_TEXT_INVOICE_URL', 'Detailed Invoice:');
define('EMAIL_TEXT_DATE_ORDERED', 'Date Ordered:');
define('EMAIL_TEXT_STATUS_UPDATE', 'Your order has been updated to the following status:  %s' . "\n\n" . 'If necessary, you may update your order directly by following the link above (login required).  If you have not created an account, and are therefore unable to login, simply reply to this email with any comments or questions.' . "\n");
define('EMAIL_TEXT_COMMENTS_UPDATE', 'The comments for your order are:' . "\n\n%s\n\n");

 

You'll probably want to customize Step 2 to better fit your store, but you get the idea. I use that particular text because I have the Customer Comments contrib (linked in my signature), so it fits for me. Make yours fit your store.

 

Let me know what you think!

 

-jared

Link to comment
Share on other sites

  • Replies 71
  • Created
  • Last Reply
We're going to changes the email subject line of all your admin-generated order status updates (except the original purchase email) from this:  Order Update  to this:  Your Great Store Order 1234: Shipped. The email title will now have the order number (handy for when you get non-quoted replies) and the order status (more obvious for the customer

 

Jared,

 

This looks (and works) great. :thumbsup: Thank you for posting it.

 

How would I go about putting the same information in the Subject of the original purchase email?

 

Roy

Roy

Link to comment
Share on other sites

How would I go about putting the same information in the Subject of the original purchase email?

 

Dunno. Haven't tried to figure that out yet, but it can't be too different - - If memory serves me well (and it generally doesn't), I believe that the code is in checkout_shipping.php. I'll have a look tomorrow and see what I can come up with.

 

-jared

Link to comment
Share on other sites

Well, shoot. I made both changes as you indicated, and it still doesn't work for me. Subject line only says "Order Update".

 

This is what I have. Did I miss something here:

 

catalog/admin/orders.php

 

$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\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

 

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT_1. $oID . EMAIL_TEXT_SUBJECT_2 . $orders_status_array[$status], $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

and

 

catalog/admin/includes/languages/english/orders.php

 

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

define('EMAIL_TEXT_SUBJECT_1', 'Your UNeedTools Store Order ');

define('EMAIL_TEXT_SUBJECT_2', ': ');

define('EMAIL_TEXT_ORDER_NUMBER', 'Order Number:');

define('EMAIL_TEXT_INVOICE_URL', 'Detailed Invoice:');

define('EMAIL_TEXT_DATE_ORDERED', 'Date Ordered:');

define('EMAIL_TEXT_STATUS_UPDATE', 'Your order has been updated to the following status: %s' . "\n\n" . 'If necessary, you may update your order directly by following the link above (login required). If you have not created an account, and are therefore unable to login, simply reply to this email with any comments or questions.' . "\n");

define('EMAIL_TEXT_COMMENTS_UPDATE', 'The comments for your order are:' . "\n\n%s\n\n");

 

$customer_notified = '1';

 

Joe

Link to comment
Share on other sites

Are you sure you edited the right files, and copied the modified ones to the right locations? What you're seeing doesn't make sense, unless perhaps you *added* that code instead of *replacing* the code.

 

For example, the phrase "Order Update" is originally defined in the language file as the variable EMAIL_TEXT_SUBJECT, which gets replaced if you follow the instructions.

 

-jared

Link to comment
Share on other sites

Well, shoot. I made both changes as you indicated, and it still doesn't work for me. Subject line only says "Order Update".

 

This is what I have.  Did I miss something here:

 

catalog/admin/orders.php

 

$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\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

 

          tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT_1. $oID . EMAIL_TEXT_SUBJECT_2 . $orders_status_array[$status], $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

and

 

catalog/admin/includes/languages/english/orders.php

 

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

define('EMAIL_TEXT_SUBJECT_1', 'Your UNeedTools Store Order ');

define('EMAIL_TEXT_SUBJECT_2', ':  ');

define('EMAIL_TEXT_ORDER_NUMBER', 'Order Number:');

define('EMAIL_TEXT_INVOICE_URL', 'Detailed Invoice:');

define('EMAIL_TEXT_DATE_ORDERED', 'Date Ordered:');

define('EMAIL_TEXT_STATUS_UPDATE', 'Your order has been updated to the following status:  %s' . "\n\n" . 'If necessary, you may update your order directly by following the link above (login required).  If you have not created an account, and are therefore unable to login, simply reply to this email with any comments or questions.' . "\n");

define('EMAIL_TEXT_COMMENTS_UPDATE', 'The comments for your order are:' . "\n\n%s\n\n");

 

          $customer_notified = '1';

 

Joe

Link to comment
Share on other sites

Yup, read it the first time. :)

 

Here's one clue that you either mis-posted or mis-configured: You note that you added this line to catalog/admin/includes/languages/english/orders.php

$customer_notified = '1';

 

That line belongs in catalog/admin/orders.php.

 

I notice in your store (the one linked in your profile) that you did not install in /catalog. Neither did I. I just put /catalog since that is the default install directory. You didn't create a new catalog directory, did you?

 

-jared

Link to comment
Share on other sites

Sorry, my reply got sent before I was through. That's why the post right before this one is blank.

 

I edited (by deleting) the code you say to replace, and replaced it with exactly what you show to replace it with. The file printout you see in my post is exactly what I changed and shows which files I made the changes to. The only change I made was by putting 'Your UNeedTools Store Order ' instead of "Your Great Store Order '...other than that, it is identical to your change.

 

Oh well, thanks for trying to figure it out. Must be a glitch somewhere.

 

Joe

Link to comment
Share on other sites

Do you have another contribution installed that may have replaced references to orders.php with a customized version?

 

If you grep through your code, looking for EMAIL_TEXT_SUBJECT, you should find it.

 

-jared

Link to comment
Share on other sites

You bring up a good point about other contributions being installed. This might be the problem. I checked the code again, and I had the "$customer_notified" in the right place, I don't know why I showed it the other way. It was under orders.php.

 

Thanks again for your help and quick reply. I am going to look at this again later. Sometimes I need to walk away from it if it isn't readily apparent where the problem is.

 

Regards,

 

Joe

Link to comment
Share on other sites

How would I go about putting the same information in the Subject of the original purchase email?  Roy

 

How 'bout this?

 

Open catalog/checkout_process.php. Find this:

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

 

change it to this:

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

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

 

Close and save.

 

Now, go open up catalog/includes/languages/english/checkout_process.php. Find this:

define('EMAIL_TEXT_SUBJECT', 'Order Process');

 

and change it to something that looks like this:

//define('EMAIL_TEXT_SUBJECT', 'Order Process');
define('EMAIL_TEXT_SUBJECT_1', 'Bob's Book Barn Order');
define('EMAIL_TEXT_SUBJECT_2', 'has been recieved.');

 

Now, the subject of your initial email messages (the ones customers get right after they check out) have changed from "Order Status" to "Bob's Book Barn Order 4316 has been recieved."

 

Did that work for you?

 

-jared

 

 

FWIW, I renamed the shipping status "Pending" to "Recieved" a while ago - - seems to make more sense to me to say "We've got your order" than "Your order is waiting for us to approve it."

Link to comment
Share on other sites

whaddya think - - should I make a contrib out of this, just to make it more visible?

 

-jared

 

Jared,

 

Thank you for your help - this worked like a charm and I think it would make a great contrib. I would expect this to be the norm rather than the exception. Seeing a list of emails that say "Order Process" in the subject is not very helpful when you are trying to process them.

 

Thanks again!

 

Roy

Roy

Link to comment
Share on other sites

Jared,

 

When I implemented this on a live site, I realized an oversight that I thought I would point out. Having activated the "Send Extra Order Emails" I found that the email that went to the store owner had "EMAIL_TEXT_SUBJECT" in the subject line.

 

I changed the following line in catalog/checkout_process.php:

 

From This:

tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

To This:

 

// ? ?tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
? ?tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT_1 . ' ' . $insert_id . ' ' .EMAIL_TEXT_SUBJECT_2, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

If you make this a contribution, you might want to include the above. Thanks again for your help.

 

Roy

Roy

Link to comment
Share on other sites

Nice catch. I just grepped through the code looking for other instances as well, and didn't find any more of them.

 

I'll include that in the contrib.

 

Thanks!

 

-jared

Link to comment
Share on other sites

This is just an alternative and simple.

 

Edit catalog/admin/includes/languages/english/orders.php

 

define('EMAIL_TEXT_SUBJECT', 'Order Update');

 

To

 

define('EMAIL_TEXT_SUBJECT', 'Your Order #' . $oID . ' ' . 'Shipped');

 

Just change your wording to your liking.

Link to comment
Share on other sites

This is just an alternative and simple.

 

Edit catalog/admin/includes/languages/english/orders.php

 

define('EMAIL_TEXT_SUBJECT', 'Order Update');

 

To

 

define('EMAIL_TEXT_SUBJECT', 'Your Order #' . $oID . ' ' . 'Shipped');

 

Just change your wording to your liking.

 

 

well, this makes the status static and assumes that the $oID is defined before the language file is loaded.

Treasurer MFC

Link to comment
Share on other sites

Jared,

 

Brilliantly easy! Thanks for this!

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

Your code has already been put to the test today on an order where more info was required, so the timing was perfect! The reply came through with details in the subject and saved my behind! :)

 

I love the spirit of this community -- the give and take. Glad I could help you out with the backorder stuff -- that was a nightmare to get right, but seems to be working well for me now. Hopefully for you too!

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

Good job Jcall. I just followed your instructions. Much nicer. Will save time.

 

The link in the default 'Order Process' and 'Order Update' emails was not clickable. Here is the Fix that can also be applied alongside this contribution.

 

http://www.oscommerce.com/community/contributions,2253

 

This will now make the link that is in the " Detailed Invoice: " Section Clickable.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...