Zen Cart Logo
Forums / Customization from the Admin / Can I address BOTH first/last name in email?

Can I address BOTH first/last name in email?

Locked

Views: 2,618

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
22 May 2010, 9:18 PM
#1
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Can I address BOTH first/last name in email?

Hi!

I have scoured the tutorials and forum, yet cannot figure out how to fix this: my emails address customer by first name only.

I disabled the Mr/Ms function because about 40% of my customers are doctors. And I do not wish to send informal emails (first name only) to customers who I have not yet earned such familiarity with.

I was able to customize my Welcome email by editing this file:
includes/languages/english/create_account.php

The following code appears to control the issue:

// greeting salutation

define('EMAIL_SUBJECT', 'Welcome to ' . STORE_OWNER);

define('EMAIL_GREET_MR', 'Dear Mr. %s,' . "\n\n");

define('EMAIL_GREET_MS', 'Dear Ms. %s,' . "\n\n");

define('EMAIL_GREET_NONE', 'Dear %s' . "\n\n");

// First line of the greeting

define('EMAIL_WELCOME', 'We wish to welcome you to the <strong>MedHarvest</strong> family of online stores.');

I cannot figure out where EMAIL_WELCOME gets defined! I used the Developer Tool search, found references to it but cannot figure out where I can tell it first_name last_name.

Any help would be very appreciated!

22 May 2010, 9:38 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I address BOTH first/last name in email?

You'll have to hard-code the changes into /includes/modules/create_account.php

22 May 2010, 11:16 PM
#3
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: Can I address BOTH first/last name in email?

Wow! That is twice in one day! Thanks for helping me again, DrByte.

I found this:> // build the message content

$name = $firstname . ' ' . $lastname;



if (ACCOUNT_GENDER == 'true') {

  if ($gender == 'm') {

    $email_text = sprintf(EMAIL_GREET_MR, $lastname);

  } else {

    $email_text = sprintf(EMAIL_GREET_MS, $lastname);

  }

} else {

 **$email_text = sprintf(EMAIL_GREET_NONE, $firstname);**

}

$html_msg['EMAIL_GREETING'] = str_replace('\n','',$email_text);

$html_msg['EMAIL_FIRST_NAME'] = $firstname;

$html_msg['EMAIL_LAST_NAME']  = $lastname;

Changed the bolded passage to:
$email_text = sprintf(EMAIL_GREET_NONE, $name);

This seemed to work. But now the problem is that there is no comma after the customers name. lololol... if it ain't one ting, its ta'other!

22 May 2010, 11:23 PM
#4
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: Can I address BOTH first/last name in email?

Any idea on how I can add the punctuation?

I would like my email to read:

Dear John Smith,

I think I need to put in one of the two passages I quoted above. I don't know which, where or how.

By how, I mean I don't know how to code it in, even if I knew where to put it. I can kind of understand what php is doing, but I can only copy and paste it.

For instance, I understood the big clue to fix my first problem was this:
$name = $firstname . ' ' . $lastname;

Then I just had to copy/paste.

Hate to bug again, but can you help one more time?

23 May 2010, 10:54 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I address BOTH first/last name in email?

Add your comma in the language file, after the %s:```
define('EMAIL_GREET_NONE', 'Dear %s[B],[/B]' . "\n\n");

23 May 2010, 4:45 PM
#6
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: Can I address BOTH first/last name in email?

You are the greatest! Thank you so much!

:clap::clap::clap::clap::clap::clap::clap:

19 Oct 2010, 10:06 PM
#7
saydie13 avatar

saydie13

New Zenner

Join Date:
May 2010
Posts:
14
Plugin Contributions:
0

Re: Can I address BOTH first/last name in email?

Hello,

I have a similar predicament that involves the first name last name error.

It seems as though my email greetings aren't consistent. On some, the $EMAIL_FIRST_NAME $EMAIL_LAST_NAME command works fine; such as in the email_template_checkout.html and the email_template_gv_mail.html

However, in my email template_order_status.html which calls the same command line, it displays the text $EMAIL_FIRST_NAME $EMAIL_LAST_NAME - not the customer's name.

I don't know what's causing this problem on this particular template. Help.. :yuck:

  • Saydie
21 Oct 2010, 4:25 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I address BOTH first/last name in email?

That's because the Admin order-status emails are built to use $EMAIL_CUSTOMERS_NAME which is the name of the customer as stored in the order details in the database.

22 Oct 2010, 3:40 PM
#9
saydie13 avatar

saydie13

New Zenner

Join Date:
May 2010
Posts:
14
Plugin Contributions:
0

Re: Can I address BOTH first/last name in email?

I see! Thanks for the clarification Dr Byte!! :smile: