Zen Cart Logo
Forums / General Questions / Special Instructions or Order Comments

Special Instructions or Order Comments

Views: 1,571

Results 1 to 13 of 13
8 Jan 2014, 6:49 PM
#1
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Special Instructions or Order Comments

I am printing the order email to a receipt printer. This receipt printer reduces the print font size to ensure that every line will fit the width of the page instead of wrapping the text. The problem I am coming across is the order confirmation page has a text box "Special Instructions or Order Comments" with what appears to be an unlimited amount of characters. How can I force a line break after say 40 characters or limit the amount of text in that box to a given number of characters. It looks like the ideal would be right around 40 characters. I would prefer to force a line break.

Thank you for your help!

8 Jan 2014, 8:05 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Special Instructions or Order Comments

This has caused me annoyances too. The comments are specifically formatted to not wrap, and there will be a way to alter that in the code. I looked a bit at it once, and in a few months it will be important to me again. I will poke at it at some point; if anyone else has time now, that would be great.

8 Jan 2014, 8:54 PM
#3
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Special Instructions or Order Comments

Is this what you want?
Attachment 13652

8 Jan 2014, 11:34 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Special Instructions or Order Comments

I think the issue is not an overall character limit, it is that the comments appear in output with "no-wrap" formatting that can force the page to be very wide, or the printout made miniscule to accommodate the comments on one line.

The OP suggestion of inserting breaks, or simply allowing the text to wrap naturally for the page, would make better output. (I hate scrolling far to the right to look at orders and to get to the "back" button.)
My case is actually text attributes, which can be a long paragraph on one line.

9 Jan 2014, 1:39 AM
#5
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Special Instructions or Order Comments

Ideally I would prefer the wrap. As GJH42 says if you have to scroll far over to the right on an email than the print on my receipt paper is so small sometimes a magnifying glass isn't any help to reading it. However if I can't get a word wrap than the character limit would be the next best thing. I just have to adjust it to 40-50 characters maximum.

9 Jan 2014, 1:40 AM
#6
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Special Instructions or Order Comments

character count is user controlled, are you printing from admin?

9 Jan 2014, 1:45 AM
#7
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Special Instructions or Order Comments

I am using the html email that is sent to the store upon order confirmation. I then have automatic email manager check the inbox and print any incoming emails to an Epson TM-U220B receipt printer.
It has to be automatic printing as we are a pizza delivery company and take all orders through zen-cart. So it automatically prints to the kitchen.

9 Jan 2014, 9:20 PM
#8
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Special Instructions or Order Comments

Would putting something such as this in the css work? If so where would I insert it?

div {
  width: 50px;
  word-wrap: break-word;
  display: table-cell;
}
10 Jan 2014, 2:21 AM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Special Instructions or Order Comments

I just checked the admin order page, and it has attribute elements contained in <nobr> elements, which is a deprecated (obsolete?) tag that forbids its content from breaking to a new line. I haven't found a CSS way to overcome that yet. It may need to be altered in the PHP file (and should be, for the future).
I haven't investigated order comments or e-mails yet.

10 Jan 2014, 7:19 AM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Special Instructions or Order Comments

I edited /admin/orders.php and replaced <nobr> and </nobr> with <span class="nobr"> and </span> in three places, lines 565, 568 and 977.
Now orders with long text attribute strings wrap to fit the space available, and apparently preserve line breaks entered in the text. I have seen no errors at this point.

I would suggest investigating the appropriate files for other instances of the no-wrap behavior per the OP to see if they can be treated similarly.

10 Jan 2014, 5:02 PM
#11
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Special Instructions or Order Comments

A search in the Developers Toolkit shows "nobr" in /admin/invoice.php (lines 170 & 173), /admin/packingslip.php (lines 154 & 155) and /includes/classes/order.php (line 876), as well as paypal files which I don't want to touch unless experience shows a need to.

/includes/classes/order.php is responsible for sending the order confirmation e-mail, so that would probably be the target file for the OP concern.

10 Jan 2014, 10:17 PM
#12
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Special Instructions or Order Comments

I found the answer to this. In email/email_template_checkout.html

I changed

body {color:#000000; font-family:Verdana, Arial, Helvetica, sans-serif; text-align:center}

to

body {color:#000000; font-family:Verdana, Arial, Helvetica, sans-serif; text-align:center; width: 40px}

This fixed the html email to have word wrap on the email receipt unless they write an essay without spaces.

11 Jan 2014, 9:06 PM
#13
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Special Instructions or Order Comments

40px is an unreasonably narrow width - about equal to 5 or 6 letters wide depending on font size. 40em would be around 40 to 60 characters wide depending on the characters and the font.