Totally Zenned
- Join Date:
- Feb 2009
- Location:
- UK
- Posts:
- 1,326
- Plugin Contributions:
- 0
Added customers_firstname to order status email
I'm creating a new look for my email templates and am adding an option to have solely the customer's firstname on the order status email.
The order status email gets its details from TABLE_ORDERS whereas the customer's firstname is within TABLE_CUSTOMERS. I have made the following edits, that work, to functions_osh_update.php but would appreciate a second look in case (most likely) there's anything to amend.
// Add in store specific order message
[B]global $db;
$cust_firstname = $db->Execute("SELECT customers_firstname
FROM " . TABLE_CUSTOMERS . "
WHERE customers_id IN (SELECT customers_id FROM " . TABLE_ORDERS . "
WHERE orders_id = $orders_id)"
); [/B]
$email_order_message = defined('EMAIL_ORDER_UPDATE_MESSAGE') ? constant('EMAIL_ORDER_UPDATE_MESSAGE') : '';
$GLOBALS['zco_notifier']->notify('ZEN_UPDATE_ORDERS_HISTORY_SET_ORDER_UPDATE_MESSAGE', $orders_id, $email_order_message);
if (!empty($email_order_message)) {
$email_text .= "\n\n" . $email_order_message . "\n\n";
}
$html_msg['EMAIL_ORDER_UPDATE_MESSAGE'] = $email_order_message;
$html_msg['EMAIL_SALUTATION'] = EMAIL_SALUTATION;
[B] $html_msg['EMAIL_FIRST_NAME'] = $cust_firstname->fields['customers_firstname'];[/B]
$html_msg['EMAIL_CUSTOMERS_NAME'] = $osh_info->fields['customers_name'];
$html_msg['EMAIL_TEXT_ORDER_NUMBER'] = OSH_EMAIL_TEXT_ORDER_NUMBER . '' . $orders_id;
$html_msg['EMAIL_TEXT_INVOICE_URL'] = '<a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, "order_id=$orders_id", 'SSL') .'"><span class="button">' . str_replace(':', '', OSH_EMAIL_TEXT_INVOICE_URL) . '</span></a>';
$html_msg['EMAIL_TEXT_DATE_ORDERED'] = OSH_EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($osh_info->fields['date_purchased']);
$html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($email_message);
$html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace("\n", '', $status_text);
$html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace("\n", '', $status_value_text);
$html_msg['EMAIL_TEXT_NEW_STATUS'] = $new_orders_status_name;
$html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace("\n", '', OSH_EMAIL_TEXT_STATUS_PLEASE_REPLY);
$html_msg['EMAIL_PAYPAL_TRANSID'] = '';