Customise Zen Cart Welcome Email – Add Company Name


Zen Cart sends both customers and store owners a number of transactional email messages throughout the shopping flow.  For example, a Welcome Email is sent on the creation of a new customer account and an Checkout Email is sent on the completion of a purchase.

There are two options available in Zen Cart – HTML email and Plain Text email.  Customers can set their email preferences from their My Account page.  The structure of the email differs between HTML and Plain Text versions.  Customisations need to be made in both versions.

To Add Company Name to Welcome Email:

Let’s start with the Plain Text email first:

  1. Firstly, we need to edit the file that is responsible for the build of the plain text email.  Open /includes/modules/create_account.php.
  2. Just before the section marked // add in regular email welcome text, enter the following:
    //Company Info Block
    $email_text .= "\n\n" . EMAIL_COMPANY_BLOCK_INTRO . $company . EMAIL_COMPANY_BLOCK_END;

    Note the reference to $company – this will display the customer’s company name.

  3. Save the modified create_account.php to /includes/modules/custom/create_account.php, where custom represents the name of your current template.

Now we are ready to define the contents of EMAIL_COMPANY_BLOCK_INTRO and EMAIL_COMPANY_BLOCK_END in the language file.

  1. Open /includes/languages/english/create_account.php.
  2. Just before the section starting with define(‘EMAIL_TEXT’… add a new section for your new statements
    define('EMAIL_COMPANY_BLOCK_INTRO',"Please note that this account has been created in the company name of ");
    define('EMAIL_COMPANY_BLOCK_END',".");
  3. Save to /includes/languages/english/custom/create_account.php, where custom represents the name of your current template.
  4. Test your customised Plain Text Welcome Email message.

Now, on to the HTML email message. The statements we added to the plain text email build now need to be added to the HTML email build.

  1. Open /includes/modules/custom/create_account.php from your custom template folder.
  2. In our new // Company Info Block, add the following statement:
    $html_msg['EMAIL_COMPANY_BLOCK_INTRO'] = str_replace('\n','',EMAIL_COMPANY_BLOCK_INTRO);
    $html_msg['EMAIL_CUSTOMER_COMPANY'] = $company;
    $html_msg['EMAIL_COMPANY_BLOCK_END'] = str_replace('\n','',EMAIL_COMPANY_BLOCK_END);
  3. For our additional statements to be included in the HTML version of the Welcome email, we will need to modify the email template. This is located at email/email_template_welcome.html.
  4. Locate the following line of code:
    <div class="content-line">$EMAIL_WELCOME</div>
  5. Insert the following underneath:
    <div class="content-line">$EMAIL_COMPANY_BLOCK_INTRO$EMAIL_CUSTOMER_COMPANY$EMAIL_COMPANY_BLOCK_END</div>

Time to test again. And test again. Test both the plain text and HTML versions of the Welcome email message in a number of browsers and email clients to ensure you are happy with both the content and the formatting of the welcome communication Zen Cart will be sending your customers.

     
   
     

More Zen Cart:

  1. Structure of Zen Cart Email Messages
  2. Tell-a-friend – Zen Cart Email Template
  3. Welcome – Zen Cart Email Template
  4. Direct Email – Zen Cart Email Template
  5. Zen Cart Explored
  1. #1 by Ron Carson on 18 January, 2010 - 2:00 am

    Firstly I want to give you a great big Thankyou.
    The welcome email company name works great. I compared other suggestions to yours and they not only didn’t work but were not even close.
    Thankyou and you have a grateful customer here.
    Ron

  2. #2 by kerrin hardy on 18 January, 2010 - 11:26 am

    Hi Ron, it’s good to hear that it worked well for you.
    Glad I could help.
    Cheers
    Kerrin

  3. #3 by Martinela on 24 October, 2010 - 9:21 pm

    I love your site. Thank you for all the clear info, is difficult to find step by step instructions.

(will not be published)

Notify me of followup comments via e-mail. You can also subscribe without commenting.