Zen Cart Logo
Forums / General Questions / Order Status emails - different template for dispatched

Order Status emails - different template for dispatched

Locked

Views: 5,776

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
22 Aug 2007, 2:13 PM
#1
ceegeeaar avatar

ceegeeaar

New Zenner

Join Date:
Mar 2007
Location:
Deep in the Black Country, UK
Posts:
34
Plugin Contributions:
0

Order Status emails - different template for dispatched

Hi

This is probably going to sound muddled but what I am trying to do is add some delivery information to the dispatch/delivered email that is sent when you change the order status.

I think this can be done quite simply by copying and altering the order status email template, then specifying the template should be used when the status is updated to dispatched.

I think this needs an 'if' and 'else' putting into admin/orders.php around line 121 but php isnt my strong point. :blink:

I also thought it might be possible to pre-fill the message box with the information when dispatched is selected as a status update but no real idea how to begin with that.

Can anybody give me a little direction, either with the 'if' and 'else' or how to go about pre-filling the message field when the status update is selected?

Thankyou very much!
Claire

22 Aug 2007, 2:31 PM
#2
ceegeeaar avatar

ceegeeaar

New Zenner

Join Date:
Mar 2007
Location:
Deep in the Black Country, UK
Posts:
34
Plugin Contributions:
0

Re: Order Status emails - different template for dispatched

.. on the other hand lines 98-100 look more promising..

if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on') && zen_not_null($comments)) {
              $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n";
            }

It could maybe preset the comments 'if' status is set to dispatched?

:lookaroun

22 Aug 2007, 5:54 PM
#3
ceegeeaar avatar

ceegeeaar

New Zenner

Join Date:
Mar 2007
Location:
Deep in the Black Country, UK
Posts:
34
Plugin Contributions:
0

Re: Order Status emails - different template for dispatched

Cracked it! :clap:

Info for anybody wanting to do the same, I altered after line 103 of admin/orders.php where it says // send emails.

It now looks like this

if ($status == '3') {
      $message = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" .
      EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
      EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
      EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
      EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) . "\n\n" .
      strip_tags($notify_comments) . 
      strip_tags(EMAIL_TEXT_DELIVERY_INFORMATION) . "\n\n" .
      EMAIL_TEXT_STATUS_PLEASE_REPLY;
  } else {
	  $message = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" .
      EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
      EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
      EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
      EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) . "\n\n" .
      strip_tags($notify_comments) . "\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_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];
//      $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
// <---- Start Edit ---->
      if ($status == '3') {
	      $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments) . nl2br(EMAIL_TEXT_DELIVERY_INFORMATION);
      } else {
	      $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
      }
// <---- End Edit ---->
      $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);

Also added a line into admin/languages/english/orders.php

define('EMAIL_TEXT_DELIVERY_INFORMATION', 'Delivery Info Goes Here');

Ive moved the comments to below the order status in the email updates, the text is done above and the html by altering email/email_template_order_status.html to suit.

Hope its useful to somebody! There is probably a better way to do it I didnt find but feeling good about it myself, will update the live site tomorrow :flex:

7 Mar 2008, 2:21 AM
#4
tracib avatar

tracib

Zen Follower

Join Date:
Oct 2007
Posts:
157
Plugin Contributions:
0

Re: Order Status emails - different template for dispatched

ceegeeaar:

Cracked it! :clap:
Hope its useful to somebody! There is probably a better way to do it I didnt find but feeling good about it myself, will update the live site tomorrow :flex:

Thank you! I had been looking every where and couldn't figure out how to do it. I was wanting to make it easier for people who downloaded a product to be able to understand when the download was ready and what to do. I was able to tailor what you did for this.

Thanks so much!:clap:

29 May 2008, 12:45 PM
#5
wiggst3r avatar

wiggst3r

New Zenner

Join Date:
Mar 2008
Posts:
39
Plugin Contributions:
0

Re: Order Status emails - different template for dispatched

I couldn't get this to work.

It kept the default text used on every order status changes.

The only one I want to change is the text sent by when you use delivered.

Any ideas?