Author Topic: Textarea field problem  (Read 5953 times)

urso.lv

  • Beginner
  • *
  • Posts: 16
Textarea field problem
« on: April 24, 2008, 15:54:15 pm »
I just noticed problem with textarea field.

I put multiple lines of text in textarea (Customer's note submitting order for example).
Then that text is returned in one string in order or in notification e-mail.

Example
I input:

First line
Second line
Third line


VirtueMart returns:

First linernSecond linernThird line

I suppose there is some problem parsing strings to/from database.

Any suggestions how to correct it?

bortolani

  • Jr. Member
  • **
  • Posts: 91
Re: Textarea field problem
« Reply #1 on: April 24, 2008, 16:05:34 pm »
I don't know in VM 1.1 but I imagine that the solution I found for VM 1.0.x works there as well.

You have to modify the ps_checkout.php and account.order_details.php and substitute $db->f("customer_note")  with   $db->f("customer_note", false);

In this way the string fetched from the DB keeps the slashes (by default the f method removes them).

Then instead using preg_replace("/\r\n|\n|\r|rn/", "<br />" $customer_note) use str_replace('\r\n', "<br/>", $customer_note)

Remember to use single quotes and not double quotes in str_replace!!!

Bruno