Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default Re: Custom Email Shows Keywords

    DrByte,

    The notifier is NOTIFY_ADMIN_ORDERS_UPDATE_ORDER_END.
    The code is too long to post completely, but the observer code summary follows with the actual code of the function calling zen_mail following that. One of the products we sell is memberships to our organization. When the customer prefers to send a check or moneyorder for the order instead of using a credit card, we defer processing the order until we receive the payment. Payment receipt is indicated by setting the order status to "shipped" by an admin. Hence the need to perform some storefront processing in the admin.

    First, test to see if the order needs to be processed. If so, query the database to retrieve necessary data. Do some preliminary processing to formulate the email to admin staff. Then call functions to generate a new member number and next membership renewal date, save that data in the database, and set up and send an email to the customer. Finally finish up the email to admin staff and send it.

    Note that the email to the customer is html (in the current tests) and the email to the admin staff is text.

    The function to create and send the email to the customer is:
    Code:
    	function febt_send_customer_member_number($new_number) {
    		// input - $new_number: string containing new member number
    		// requires - $_SESSION['customer_id']
    		global $db;
    		// send email to customer with new number
    		// get email address
    		$query = $db->Execute("select customers_email_address, customers_lastname, customers_firstname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
    		$email_text = NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_SALUTATION . $query->fields['customers_firstname'] . ",\n\n" . NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_TEXT1 . "\n\n" . NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_TEXT2 . $new_number . ". " . NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_TEXT3 . "\n\n" . NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_TEXT4 . "\n\n";
    		$html_msg['EMAIL_SUBJECT'] = "<strong>" . NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_SUBJECT . "</strong><br /><br />";
    		$html_msg['EMAIL_MESSAGE_HTML'] = NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_SALUTATION . $query->fields['customers_firstname'] . ",<br /><br />" . NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_TEXT1 . "<br /><br />" . NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_TEXT2 . $new_number . ". " . NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_TEXT3 . "<br /><br />" . NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_TEXT4;  
    		zen_mail($query->fields['customers_firstname'] . ' ' . $query->fields['customers_lastname'], $query->fields['customers_email_address'], NEW_MEMBER_NUMBER_NOTIFICATION_EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg);
    	}
    The message variables $html_msg and $email_text have been inspected and are correct. A portion of the email showing the template keywords follows.
    Name:  Screenshot 2024-08-13 at 7.50.59 AM.jpg
Views: 151
Size:  23.1 KB

    There are no errors in the log.

    Dave
    zc 1.5.7c

  2. #2
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default Re: Custom Email Shows Keywords

    I wonder if my problem is related to the admin email format setting which is set to "text"?

  3. #3
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default Re: Custom Email Shows Keywords

    Nope. Set admin email text format to html. Email to customer is unchanged. Email to admin staff is now html but instead of the text that was appearing, the email looks the same as the customer's email with all the template keywords. What is going on???

  4. #4
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default Re: Custom Email Shows Keywords

    I found that function zen_build_html_email_from_template is selecting 'email_template_order_status.html' instead of 'email_template_default.html', even though $module is 'default'. Don't know why.
    Dave

  5. #5
    Join Date
    Jun 2012
    Posts
    481
    Plugin Contributions
    0

    Default Re: Custom Email Shows Keywords

    Setting $current_page to NULL allowed function zen_build_html_email_from_template to find the correct email template. Problem solved.
    Dave

 

 

Similar Threads

  1. Custom keywords
    By provida in forum General Questions
    Replies: 0
    Last Post: 20 Dec 2010, 01:07 PM
  2. Custom keywords
    By josefs in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 28 Aug 2008, 09:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg