Jump to content

Formatting of Public Note Content field in email template


Daamon

Recommended Posts

Hi,

We regularly add custom notes to the "Public Note Content" field in the Order Notes. We've inserted the code {$DATA.note_to_customer} into the HTML of the Completed Order email template, but the new lines in the "Public Note Content" field aren't being respected when the email is sent.
Example:

- "Public Note Content" field:

Text line 1

Text line 2 on a new line with a blank line between

- Email: Text line 1 Text line 2 on a new line with a blank line between

How can we get new lines to appear in the email? Thanks.

Link to comment
Share on other sites

that should be working, but make sure the note is on the order BEFORE you set the status to completed. I've a theory it wont send it if you do it all at the same time.

I would use:

 {if isset($DATA.note_to_customer) && !empty($DATA.note_to_customer)}
<YOUR STUFF GOES HERE>
{$DATA.note_to_customer}

{/if}

 

Link to comment
Share on other sites

I don't know about a timing thing. If it worked, great.

But realize that when rendering an HTML page, the rules say to collapse all contiguous white space to a single space. Thus, spaces, tabs, and new lines (CRLF) when found together, get displayed as a single space.

HTML respects only the <br> tag to start a new line. A browser will add some line spacing to break apart paragraphs using the <p> tag. (And there is the <div> tag to make blocks of content.)

The template rendering engine can use a modifier on the variable's content. Try: {$DATA.note_to_customer|nl2br}

This has the rendering engine insert an HTML <br> tag before the actual new line character. Of course, the plain text version of the email will respect all white space characters.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...