Daamon Posted October 7, 2016 Share Posted October 7, 2016 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. Quote Link to comment Share on other sites More sharing options...
Noodleman Posted October 7, 2016 Share Posted October 7, 2016 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} Quote Link to comment Share on other sites More sharing options...
Daamon Posted October 9, 2016 Author Share Posted October 9, 2016 Thanks, it was a timing thing. And the code is useful too. Much appreciated! Cheers! Quote Link to comment Share on other sites More sharing options...
bsmither Posted October 9, 2016 Share Posted October 9, 2016 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. Quote Link to comment Share on other sites More sharing options...
Noodleman Posted October 10, 2016 Share Posted October 10, 2016 it's possible there is a bug / enhancement here, if I get chance today I will check into it. The note should be saved, then the process which sends the mail read that note to include in the mail. I don't think that's happening at the moment. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.