If this is your first visit, check our documentation. To post, register or login.
Forums / Discounts/Coupons, Gift Certificates, Newsletters, Ads / Send Gift Certificate - Your Message Loses 'carriage returns'

Send Gift Certificate - Your Message Loses 'carriage returns'

Started by tvsupport on 29 Jul 2011, 2:39 PM · Views: 1,134

Results 1 to 5 of 5
29 Jul 2011, 2:39 PM
#1
tvsupport avatar

tvsupport

New Zenner

Join Date:
Oct 2008
Posts:
16
Plugin Contributions:
0

Send Gift Certificate - Your Message Loses 'carriage returns'

It's a simple problem but I don't know the solution! The message entered by someone in the 'Your message' text area when they send a gift certificate loses any new lines:

eg.

Bob
Here is your present
Love Cindy

becomes

Bob Here is your present Love Cindy on both the preview and the final email.

How can I retain the CRLF's/new lines/br's/paras or whatever you want to call them?

Any help greatly appreciated, I've searched high and low for an answer to this. :frusty:

29 Jul 2011, 3:09 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Send Gift Certificate - Your Message Loses 'carriage returns'

In the Catalog ... Option Name Manager ...

On the Option Name for:
Your message

set the
Rows to 5
Maximum length: 500 (or however many characters)

Now the customer can write what they want with enters on the new lines and you will see this on the Order ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Aug 2011, 4:37 PM
#3
tvsupport avatar

tvsupport

New Zenner

Join Date:
Oct 2008
Posts:
16
Plugin Contributions:
0

Re: Send Gift Certificate - Your Message Loses 'carriage returns'

Thanks for the reply, understand but unfortunately it's not something I've personally setup (which is what you are pointing to) but a default php files that's used to send a gift certificate as part of the system files

It's the form that creates $EMAIL_MESSAGE_HTML (used by the gv_send email template) from the send gift certifcate page. It strips the returns from the email preview and the actual email when you send it but interestingly if you go to re-edit the email message from the preview page it shows them in the multi line text area.

There is a template 'tpl_gv_send_default.php' used to control how the send gift cert page looks which I guess uses this:

stripslashes($_POST['message']);

to preview the message.

I guess it does something similar somewhere else when it send it which is also getting rid ot the returns.

Am I making any sense?

1 Aug 2011, 5:19 PM
#4
swag_nyc avatar

swag_nyc

New Zenner

Join Date:
Aug 2011
Posts:
2
Plugin Contributions:
0

Re: Send Gift Certificate - Your Message Loses 'carriage returns'

the key I think is in $EMAIL_MESSAGE_HTML

try forcing breaks in HTML format, not by simply hitting enter in the form field

when you want a new line type ```
<br />

to space a line use 2 in a row

<br /><br />


ipso lorum est bulldoodoo <br /> Nextus linus overis hereus
<br /><br />The Management


should give you:

ipso lorum est bulldoodoo
Nextus linus overis hereus

The Management


the problem is form data does this sort of thing from the textbox, if you don't manually break it you need some sort of scripting to turn windows carriage returns into HTML linebreaks since the windows /n (new line code) does not auto translate into html breaks. or you could specify in a string processing script to html break the string after x number of characters
1 Aug 2011, 7:08 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Send Gift Certificate - Your Message Loses 'carriage returns'

swag-nyc might want to reconsider that suggestion. Adding <br /> tags will cause your text-only emails to contain <br /> text which is meaningless to recipients.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.