If this is your first visit, check our documentation. To post, register or login.
Forums / Customization from the Admin / Can I Address only First name in Welcome Message?

Can I Address only First name in Welcome Message?

Started by adem_i on 15 Jan 2012, 9:56 AM · Views: 941

Results 1 to 3 of 3
15 Jan 2012, 9:56 AM
#1
adem_i avatar

adem_i

New Zenner

Join Date:
Jul 2010
Location:
Sydney, Australia
Posts:
86
Plugin Contributions:
0

Can I Address only First name in Welcome Message?

Hi,

I've searched far and wide for any information or prior case where someone has wanted to address their customers via first name only in the welcome email after registration.

I'd like the email to start with

Hi <first name>,

Contents of email here.

I've found a similar thread here

however my knowledge of coding isn't sufficient to change it around.

Currently the code in the contact_us.php is

define('EMAIL_SUBJECT', 'Welcome to ' . STORE_NAME);
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");

Any help would be appreciated

relatively new to Zen Cart

15 Jan 2012, 10:15 AM
#2
adem_i avatar

adem_i

New Zenner

Join Date:
Jul 2010
Location:
Sydney, Australia
Posts:
86
Plugin Contributions:
0

Re: Can I Address only First name in Welcome Message?

I tried changing that code around trying my luck... didn't work

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

if (ACCOUNT_GENDER == 'true') {

$email_text = sprintf('Hi %s', $firstname);

	} else {

		$email_text = sprintf('Hi %s', $firstname);

	}

$html_msg['EMAIL_GREETING'] = str_replace('\n','',$email_text);
$html_msg['EMAIL_FIRST_NAME'] = $firstname;
$html_msg['EMAIL_LAST_NAME'] = $lastname;

relatively new to Zen Cart

16 Jan 2012, 3:38 PM
#3
adem_i avatar

adem_i

New Zenner

Join Date:
Jul 2010
Location:
Sydney, Australia
Posts:
86
Plugin Contributions:
0

Re: Can I Address only First name in Welcome Message?

Hi again,

in includes>languages>english>create_account.php
I made the following edit

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

in admin/email_welcome.php

// build the message content

/* 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;

However now when test it, the output is (where lastname = cde)

Hi cde,

Why isnt it showing first name yet?

Regards,
Adem

relatively new to Zen Cart