Word wrap in order notes...

Not sure if this is an issue or config question, but in invoice.tpl there is the following code near the bottom regarding the customer notes within an order.


{if $order_info.notes}






{$lang.notes}:
{$order_info.notes|wordwrap:85:"\n":false|nl2br}





As you can see, that “Notes:” field at the bottom of invoices and emails is designed to break at 85 characters for each line. I don't want that, nor do I think many of you would want that either?



So, what is the proper cross-browser code to get it to wrap at word breaks instead of characters?



Thanks for any help, can't find the right command to replace the “85” with.



[EDIT : Ok, sort of strange, on another order with different notes, it looks fine and seems to be breaking at words. But for the first/problem order, it is breaking a line that ends with “ourdomainname.com.” and puts “ourdomainname” on one line, and then the “.com.” on the next. This is what the problem order notes look like :



Thank you for your gift card order. We look forward to serving you again at

www.ourdomainname

.com.



Something to do with the periods? I'd like to be able to enter in notes without worrying about how it will look on the recipient's end. Odd. ?]

An update for anyone interested, received a response from CS support so that periods are included in the previous word for wrapping. I would think this would be the desired norm or default, but whatever.



Replace the following code in modifier.wordwrap.php in core/templater_plugins :


function smarty_modifier_wordwrap($str, $width = 80, $break = "\n", $cut = false)
{
if (!$cut) {
$regexp = '#^(?:[\x00-\x7F] | [\xC0-\xFF][\x80-\xBF]+){' . $width . ',}\b#U';
} else {
$regexp = '#^(?:[\x00-\x7F] | [\xC0-\xFF][\x80-\xBF]+){' . $width . '}#';
}




with this :


function smarty_modifier_wordwrap($str, $width = 80, $break = "\n", $cut = false)
{
if (!$cut) {
$regexp = '#^(?:[\x00-\x7F]\. | [\xC0-\xFF][\x80-\xBF]+\.){' . $width . ',}\b#U';
} else {
$regexp = '#^(?:[\x00-\x7F]\. | [\xC0-\xFF][\x80-\xBF]+\.){' . $width . '}#';
}




Seems to work for me, hope that helps others who want this functionality.

Hi. I did this same modification and it seemed to work great, however, I'm now noticing a
tag being inserted right above the notes written by the customer. Is there anyway to remove that? Otherwise the text doesnt line up with the word “notes” as follows…



Currently looks like this:


Notes:
Please include free stickers.




but should be like this:


Notes: Please include free stickers.

^ Correction… It seems to add a
for every line the customer writes in the notes. So if it's a long note (say 6 lines worth) it will add 6
tags above the text. (Basically for every line break.) Need to correct this asap!

hpt - I have no ideas for you, except to say make sure your code looks exactly how this post reads, and that you have no extra spaces or whitespace at the end of your lines. Also, this fix was done on an earlier version of CS (can check if you want me to), so perhaps 2.2.5 is not the same.