X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Changing Email Greeting to show First Name Only (https://forum.x-cart.com/showthread.php?t=63627)

Henry 05-14-2012 07:58 PM

Changing Email Greeting to show First Name Only
 
When a customer places an order they will receive an email that contains their invoice and the following text:

Hello John Smith, Thank you for your order. Please come back soon!

When the order status is changed to complete they will receive their order has been completed email that has the following text:

Hi John Smith, Your order has been completed successfully.

I would like to have just the Customers First Name show on all emails. I changed the code in salutation.tpl to the following and the First Name will show on Order Completed Emails but on the email that contains their invoice it will just show "Hello ,"

---------------------------------------------------
{* $Id: salutation.tpl,v 1.1 2010/05/21 08:32:15 joy Exp $ *}
{strip}
{if $salutation ne ""}
{$lng.eml_dear|substitute:"customer":"`$customer.f irstname`"}
{else}
{if $firstname eq "" and $lastname eq ""}
{$lng.eml_dear|substitute:"customer":"`$customer.f irstname`"}
{else}
{$lng.eml_dear|substitute:"customer":"`$customer.f irstname`"}
{/if}
{/if}
{/strip},
-----------------------------------------------------

I did also try to change the Language variable in
eml_dear but I am not sure what to use to call out the First Name. I tried "firstname", "customer.firstname", ect but nothing worked.


Any help with this would be appreciated.


totaltec 05-15-2012 05:36 AM

Re: Changing Email Greeting to show First Name Only
 
Look at: /common_files/mail/html/order_customer.tpl

This line:
<br />{include file="mail/salutation.tpl" title=$order.title firstname=$order.firstname lastname=$order.lastname}

That should clear up what you need to do, if not just ask.

Henry 05-15-2012 05:58 AM

Re: Changing Email Greeting to show First Name Only
 
Hello,

Thank you for the reply. I looked at the code you indicated but I am not sure what you are pointing out. That is the same line of code that is also in common_files/mail/html/order_customer_complete and only the first name is showing on the completed emails. I am not sure if I am looking at this incorrectly but both of these files - order_customer and order_customer-complete are calling for the salutation.tpl file to be included in the email. Since I have the substitute code in the salutation.tpl file the first name should show on both emails.

totaltec 05-15-2012 09:34 AM

Re: Changing Email Greeting to show First Name Only
 
No problem. See this code from salutation.tpl:
PHP Code:

{if $salutation ne ""}
   {
$lng.eml_dear|substitute:"customer":$salutation}
{else}
   {if 
$firstname eq ""}
       {
$lng.eml_dear_customer}
   {else}
       {
$lng.eml_dear|substitute:"customer":"`$title` `$firstname` `$lastname`"}
   {/if}
{/if} 


In your example you are substituting "customer" with $customer.firstname.

When passed from /common_files/mail/html/order_customer.tpl the $customer array is not set. $order is what it is pulling from, as you can see from the scrap of code I posted above.

To accomplish your goal, I believe you only need to remove the reference to $title and $lastname in salutation.tpl. Like this:
PHP Code:

{strip}
{if 
$salutation ne ""}
   {
$lng.eml_dear|substitute:"customer":$salutation}
{else}
   {if 
$firstname eq "" and $lastname eq ""}
       {
$lng.eml_dear_customer}
   {else}
       {
$lng.eml_dear|substitute:"customer":"`$firstname`"}
   {/if}
{/if}
{/
strip}, 


Henry 05-15-2012 09:41 AM

Re: Changing Email Greeting to show First Name Only
 
That was it. Thank you for the help on this one. This has been on my to do list for some time so thanks again!:-)


All times are GMT -8. The time now is 11:36 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.