Zen Cart Logo
Forums / General Questions / Send different email depending on order status

Send different email depending on order status

Locked

Views: 3,448

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
7 Mar 2008, 5:01 PM
#1
eden avatar

eden

New Zenner

Join Date:
Feb 2006
Posts:
19
Plugin Contributions:
0

Send different email depending on order status

I need help configuring my cart to send a slightly different email depending on order status.
I am using zencart to sell event tickets.
When a customer orders a ticket they are sent the order confirmation email which includes the "order number". This is set in: includes/languages/english/your_template/checkout_process.php. line 27

I have set up the cart so that when I update the order to delivered, it sends the order update email but instead of showing "order number", it shows "ticket reference number". This is set in:
admin/includes/languages/english/orders.php. line 76

My problem with this is that admin/includes/languages/english/orders.php deals with all update types and if someone pays by check or money order I want to update the order to processing, and for the email to show "order number" but when I do, it sends the update email which shows "ticket reference number" not "order number".

How can I change the "processing" update email to show "order number" and leave the "delivered" update email to show "ticket reference number"?

18 Sep 2008, 8:42 PM
#2
fsas avatar

fsas

New Zenner

Join Date:
Sep 2008
Posts:
30
Plugin Contributions:
0

Re: Send different email depending on order status

I would like to add different texts in the confirmation mails, depending on the status of the order.

(1) the first question is how to add text to a confirmation mail. Should I try to edit the order.php or is there a more easy way?

(2) can I send different texts? To put it in other words: can I add different texts to the emails that are send when the order status is updated?
I don't mean the comments I can send with them. I would like it to be a standard, automatic, text for every status.

Would this be possible and if so, how can I accomplish this?

thanks!

21 Sep 2008, 3:08 PM
#3
fsas avatar

fsas

New Zenner

Join Date:
Sep 2008
Posts:
30
Plugin Contributions:
0

Re: Send different email depending on order status

Took a while, but finally found it. For those who also want to do this:

In (a copy of) admn/orders.php I added the following code, just after the //send emails comment. It's dutch, but you'll get the idea...

No garantees whatsoever: I'm a beginner.

 //send emails
if ($orders_status_array[$status]=="besteld"){	
 define('EMAIL_TEXT_ANJO1', ''); 
 define('EMAIL_TEXT_ANJO2', 'Wacht svp met betalen tot uw order de status -bevestigd- heeft. De status van de bestelling staat hieronder aangegeven.'); 
}
elseif ($orders_status_array[$status]=="bevestigd")	{
 define('EMAIL_TEXT_ANJO1', 'Het totaal van uw bestelling kunt U vinden in de eerste mail of op de site (zie de verwijzing naar de gedetailleerde factuur verderop in deze mail). U kunt het geld voor uw bestelling overmaken op giro 375.18.75 (3751875) t.n.v. J. Smits Utrecht, onder vermelding van het bestelnummer dat hierboven staat. Zodra de betaling (’s avonds) zichtbaar is verzend ik het zo snel mogelijk. Dat is meestal binnen 1-2 werkdagen (in het weekeinde of met schoolvakanties kan het dus wat langer duren).');
 define('EMAIL_TEXT_ANJO2', 'Als u nog voorkeur heeft voor de frankering van uw bestelling kunt u kiezen uit de zegels die ik voor porto gebruik. Deze zijn te vinden op www.anjozegels.nl/index.php?main_page=anjofrankeerz .');
}
elseif ($orders_status_array[$status]=="verzonden")	{
 define('EMAIL_TEXT_ANJO1', 'Het geld staat er inmiddels op en het gaat zo snel mogelijk op de bus. Veel plezier ermee!'); 
 define('EMAIL_TEXT_ANJO2', 'Mocht een zegel een mankement vertonen dat niet in de advertentie of op de afbeelding beschreven staat of zichtbaar is dan mail me maar even, dan kunnen we proberen dat op te lossen. Alhoewel ik zorgvuldig probeer te werken, kan ik natuurlijk altijd iets over het hoofd zien.'); 
}
else {
 define('EMAIL_TEXT_ANJO1', ''); 
 define('EMAIL_TEXT_ANJO2', ''); 
}
 define('EMAIL_TEXT_ANJO3', 'met vriendelijke groeten, Anjo'); 

          $message = STORE_NAME . "\n" . 
          EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_SEPARATOR . "\n\n" .
          strip_tags($notify_comments) . 
"\nDag!\n\n" . 
EMAIL_TEXT_ANJO1 . "\n\n" .
EMAIL_TEXT_ANJO2 . "\n\n" .
EMAIL_TEXT_ANJO3 . "\n\n" .
EMAIL_SEPARATOR . "\n\n" .
// anjo          EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
EMAIL_TEXT_STATUS_UPDATED . sprintf($orders_status_array[$status] ) . "\n\n" .
          EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
          EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
EMAIL_SEPARATOR . "\n\n" .
          EMAIL_TEXT_STATUS_PLEASE_REPLY;

          $html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
          $html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
          $html_msg['EMAIL_TEXT_INVOICE_URL']  = '<a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') .'">'.str_replace(':','',EMAIL_TEXT_INVOICE_URL).'</a>';
          $html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']);
          $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
          $html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
          $html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
          $html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];