If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / Managing Customers and Orders / Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

Started by ted_grapler on 21 Feb 2021, 6:32 PM · Views: 7,018

Results 1 to 14 of 14
21 Feb 2021, 6:32 PM
#1
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

ZenCart 1.5.7b, PHP 7.4, Clone-a-Template 1.2.1, Edit Orders 4.5.5, Zen Colorbox 2.2.2, Image Handler 5.1.9

In the (hopefully) final stages of getting my vintage 1.5.4 cart upgraded to 1.5.7b- in test environment on a VPS have been using Mailtrap.io to make sure the emails sent from my ZC install are working properly.

The status update mails sent through ZC show "$EMAIL_SALUTATION" text instead of the word "Dear" and at the bottom of the message it shows "$EMAIL_ORDER_MESSAGE_UPDATE" text.

Spent many hours trying to resolve but no luck.

The Welcome email that a new customer receives when they sign up DOES include Dear. The Order Confirmation the buyer receives looks fine- just has their first and last name (no Dear) and there is no $EMAIL_ORDER_MESSAGE_UPDATE text at the bottom of their email. The Order Update emails all have the issue.

In MY_ADMIN/includes/languages/english.php line 585 it shows define('EMAIL_SALUTATION', 'Dear');

The test cart doesn't have a real domain name attached to it so have modified the hosts file on my PC to access the site, I don't think this would cause this issue but please someone correct me if this is wrong. Don't think I modified any of the Zen Cart files that might be related to this but it's possible.

Any advice very much appreciated.

Thanks, Ted

21 Feb 2021, 7:18 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

Check against a fresh download of 1.5.7b:

email/email_template_order_status.html
includes/functions/functions_osh_update.php

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

21 Feb 2021, 7:52 PM
#3
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

Thanks for the response. I just made 100% sure both of those files are untouched/same as original 1.5.7b files. Then sent a "payment received" status update email to my test customer, unfortunately the issue remains.

Ted

21 Feb 2021, 8:10 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

Hmm, I'm not seeing those language definitions on the storefront. I am seeing them in admin/includes/languages/english.php

22 Feb 2021, 2:17 PM
#5
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

I've tried copying define('EMAIL_SALUTATION', 'Dear'); to various related files both inside and outside the ADMIN folder but doesn't make any difference. Is there a place I can add this that might fix the issue?

22 Feb 2021, 4:23 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

I tested this issue today with a fresh download of 1.5.7b and found it worked perfectly, both when the order was updated on the order details page and when it was updated from the sidebar from the order list page.

Can you double check admin/orders.php and make sure it matches 1.5.7b?

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Feb 2021, 8:35 PM
#7
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

Made 100% sure that the MY_ADMIN/orders.php was untouched.

So it turns out the issue only occurs when I send emails from my site after selecting an Order and clicking the Edit button. If I click the Details button instead and send order update emails that way the emails are delivered error free with Dear as salutation, no apparent issues. Probably should have noticed this earlier but for the last 6 years or so only have been using Edit.

Will try to play around with the Edit Orders plug in, maybe try deleting it then reinstalling, if that doesn't work will ask for help in Edit Orders thread.

Thanks lat9 and swguy.

Ted

22 Feb 2021, 9:24 PM
#8
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

I'd say just don't add comments using Edit Orders then. :) Edit Orders is for editing - if all you're doing is setting status use the regular built-in Order Display page.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Feb 2021, 11:22 PM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

Successfully reproduced. This is an issue with Edit Orders. Until a fix is available, do your status updates either from the order list or from the order details page.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Feb 2021, 11:24 PM
#10
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

swguy:

I'd say just don't add comments using Edit Orders then. :) Edit Orders is for editing - if all you're doing is setting status use the regular built-in Order Display page.

i agree with @swguy on this one..... however....

clearly a bug in edit_orders. if edit_orders allows you to send an email it should be formatted correctly.

around line 242 of YOUR_ADMIN/edit_orders.php, you can add:

                $html_msg['EMAIL_ORDER_UPDATE_MESSAGE'] = defined('EMAIL_ORDER_UPDATE_MESSAGE') ? constant('EMAIL_ORDER_UPDATE_MESSAGE') : '';
                $html_msg['EMAIL_SALUTATION'] = EMAIL_SALUTATION;

those elements need to be defined (or removed from the html message template).

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

22 Feb 2021, 11:35 PM
#11
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

23 Feb 2021, 5:23 AM
#12
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

the more i think about this, the less unsure i am about it.

we could get into the whole structure of sending email.... which frankly is far too complex and to me in need of a refactor...

the actual sending of the email gets done in the function zen_mail. this is where the PHPMailer object gets created. and yet this same function is also dealing with this html_msg array (now called block).

and if we look at this section of code:

https://github.com/zencart/zencart/blob/d49f2fff42dc8089229db050fa777e908c8b7939/includes/functions/functions_email.php#L101-L109

or this section of code:

https://github.com/zencart/zencart/blob/d49f2fff42dc8089229db050fa777e908c8b7939/includes/functions/functions_email.php#L581-L595

there is a bunch of testing for isset of elements of the array.

if ZC is to provide plugins the ability to use a template for sending a mail, should ZC not account for elements of the array not included in the message?

i am not sure what the answer is, but if the zen_mail function is the only time ZC sends an email, i think there is far too much going on to process an array utilizing some template that has required elements, that if not provided, result in the email seen by ted.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

26 Feb 2021, 1:41 PM
#13
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

Adding the recommended code around line 242 of YOUR_ADMIN/edit_orders.php solved this issue for me My order status update emails now have "Dear" as salutation and no extra unwanted text. Thank you carlwhat.

26 Feb 2021, 3:28 PM
#14
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Customer email text/format problems - $EMAIL_SALUTATION + $EMAIL_ORDER_MESSAGE_UPDATE

Ted Grapler:

Adding the recommended code around line 242 of YOUR_ADMIN/edit_orders.php solved this issue for me My order status update emails now have "Dear" as salutation and no extra unwanted text. Thank you carlwhat.

:thumbsup:

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.