Zen Cart Logo
Forums / General Questions / How can I place 'FIRST_NAME' in the email_template_default.html email?

How can I place 'FIRST_NAME' in the email_template_default.html email?

Views: 764

Results 1 to 8 of 8
1 Aug 2013, 1:54 PM
#1
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

How can I place 'FIRST_NAME' in the email_template_default.html email?

Hi

I like to customize the email sent when customer is authorized for the fist time to say

In customers.php I have this.

define('EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE', 'Welcome [I want FIRST_NAME _TO_GO_HERE] to <strong> Premier Salon Supplies</strong>.
Your wholesale account has been approved.
<br /><br />
As a ‘Thank You’ for registering with us, we would like to offer you 10% off your first online order.
<br /><br />
Use the coupon code <strong>SWEET</strong> at checkout to take advantage of this offer.
<br /><br />
Online Shop – <strong>http://www.premiersalon.com.au</strong>
<br />
');

and in the

email_template_default.html

<!-- Content Section --> <div class="content"> <!--<div>$EMAIL_SUBJECT</div>--> <div>$EMAIL_MESSAGE_HTML</div> </div>

but tried everything can't get the first name in the email showing.

1 Aug 2013, 3:54 PM
#2
drbyte avatar

drbyte

Sensei

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

Re: How can I place 'FIRST_NAME' in the email_template_default.html email?

a) add %s where you want to put that placeholder in the define for EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE
b) use Developers Toolkit to find where EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE is used, and alter the code to do the parameter substitution with the value you want inserted. sprintf(NAME_OF_CONSTANT, $substitution1, $substitution2, $substitution3 etc)

2 Aug 2013, 12:08 AM
#3
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: How can I place 'FIRST_NAME' in the email_template_default.html email?

Dr as always your suggestions and your time are valued and appreciated. Thank you.

It's that simple hmmm (not for me) . Why isn't that FIRST_NAME variable not already available for any of the emails? You already have FIRST _NAME and LAST_NAME (see below) but when I want to use it in /home/premiers/public_html/myadmin/includes/languages/english/customers.php the I get exactly as I entered FIRST _NAME in the received email.

<!-- Content Section --> <div class="content"> <div>Dear $EMAIL_FIRST_NAME $EMAIL_LAST_NAME,</div> <div>$EMAIL_MESSAGE_HTML</div> </div>

Do we really need to become a coder to do this simple yet most probably be a common request. Saying that I have not found a post anyone asking such request ..may be its not as common as I thought it would be.

'..and alter the code to do the parameter substitution with the value you want inserted. sprintf(NAME_OF_CONSTANT, $substitution1, $substitution2, $substitution3 etc)' .......this really throws the baby out of the bucket for me.

I have done this so far as you suggested. EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE only appears in one file. /home/premiers/public_html/myadmin/includes/languages/english/customers.php. So don't say I have not done my homework :-)

b) I use Developers Toolkit to find where EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE is used,
This is what I found. This is where I had already added some text before. Now all I wanted was to insert the name after the word 'Welcome' . Is that where I place the s%

//define('EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE', 'Your customer status has been updated. Thank you for shopping with us. We look forward to your business.');

define('EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE', 'Welcome [NAME_%s_HERE?] to <strong> Premier Salon Supplies</strong>.
Your wholesale account has been approved.
<br /><br />
As a ‘Thank You’ for registering with us, we would like to offer you 10% off your first online order.
<br /><br />
Use the coupon code <strong>SWEET</strong> at checkout to take advantage of this offer.
<br /><br />
Online Shop – <strong>http://www.premiersalon.com.au</strong>
<br />
');

2 Aug 2013, 12:58 AM
#4
drbyte avatar

drbyte

Sensei

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

Re: How can I place 'FIRST_NAME' in the email_template_default.html email?

  1. /admin/includes/languages/english/customers.php
    line 63 change from define('EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE', 'Your customer status has been updated. Thank you for shopping with us. We look forward to your business.');to something like```
    define('EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE', '[B]Hi, %s. [/B]Your customer status has been updated. Thank you for shopping with us. We look forward to your business.');

2. /admin/customers.php
lines 80-81 change from ```
              $message = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE;
              $html_msg['EMAIL_MESSAGE_HTML'] = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE ;
```to```
              $message = [B]sprintf([/B]EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE[B], $custinfo->fields['customers_firstname'])[/B];
              $html_msg['EMAIL_MESSAGE_HTML'] = [B]$message[/B];
3 Aug 2013, 6:22 AM
#5
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: How can I place 'FIRST_NAME' in the email_template_default.html email?

No wonder they call you Dr. ..Mother of all Doctors, thank you so much. I will try your suggestions.

3 Aug 2013, 6:42 AM
#6
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: How can I place 'FIRST_NAME' in the email_template_default.html email?

Ok I have changed those lines but no email received. After defaulting back to the original in /admin/customers.php, I did get an email with the line ' Welcome %s to Premier Salon Supplies. Your wholesale account has been approved. '

So another words something wrong somewhere.

// added customer welcome email personalised with a FIRST_NAME
//$message = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE;
$message = sprintf(EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE, $custinfo->fields['customers_firstname']);
// $html_msg['EMAIL_MESSAGE_HTML'] = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE ;
$html_msg['EMAIL_MESSAGE_HTML'] = $message;

5 Aug 2013, 9:51 PM
#7
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: How can I place 'FIRST_NAME' in the email_template_default.html email?

Sorry Dr. its only a bump :-(

I need a solution for my problem please. Can anyone suggest ?

Thanks

6 Aug 2013, 7:03 PM
#8
drbyte avatar

drbyte

Sensei

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

Re: How can I place 'FIRST_NAME' in the email_template_default.html email?

Any myDebug-adm-xxxxxx.log files in your /logs/ folder?