5
« on: August 03, 2020, 07:53:01 AM »
Email templates were introduced in version 1.2.16, I've belatedly discovered. This has given me some grief. The original templates for order notification emails have not been removed. So I naively thought, not having realised that these new templates had been introduced, if I edited these old templates I'd see the result in the generated emails. How wrong I was. Even if I inserted error_log's in the these templates, the 'error' message would come out, so I knew the template was being executed, but the HTML around error_log did not appear in the email (tearing of hair)! Following the code for emails pointed me to the new email templates. Serves me right, you might say, for not reading the release notes, but why keep the old templates, and load them? The release notes also announced the new editor of these templates in the Control Panel. Great! - or was it. I needed to change the column heading 'Model' to 'Author' - our shop sells books - simple enough in this editor, although a placeholder would have been useful. When I did that the result was catastrophic. Here is a portion of the HTML produced:
<th class="align_left" style="color: #ffffff;">Author</th>
<th class="align_right" --n--=""> style="width: 10%; padding: 0.3em; color: #FFFFFF;">Price</th>
<th class="align_right" --n--=""> style="width: 15%; padding: 0.3em; color: #FFFFFF;">Quantity</th>
My new Author line was OK, but the following lines had this extra text inserted after the "align_right". I think what is happening is that because the <th...> tag was split over two lines, the editor has inserted this
--n--""> What's more, the end ">" has got converted to >
The work-around is to delete the newline and keep the <th > tag on one line even it wraps around, and change the >: to >
In fact I found this has happened at a number of places in the template file.