VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Questions VM 1.1 ( the only active board for the old version) => Topic started by: on April 24, 2008, 15:54:15 pm

Title: Textarea field problem
Post by: 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.

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?
Title: Re: Textarea field problem
Post by: bortolani 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!!!