You are here:  » \n problem

Support Forum



\n problem

Submitted by Mik3 on Wed, 2007-11-14 19:43 in

My site feed has \n to reflect new line in each of the product descriptions and these are showing up in my site.. any suggestions?

Thanks

Submitted by support on Wed, 2007-11-14 19:58

Hi,

The easiest thing to do would be to add a Search and Replace filter against the description field for this feed, searching for "\n" (without the quotes), and either replacing with a space, or if you want to use the new-lines you could replace with "<br />".

Hope this helps!
Cheers,
David.

Submitted by Mik3 on Wed, 2007-11-14 20:39

David,

Unfortunately I've tried this.

I've gone in, adding in spaces and the and each time when I look at the products im seeing something similar to the following (taken from actual product page)

"green.nnSize 105mm x 95mm"

the nn is where the \n\n appears in the xml file.

Thanks,

Mike

Submitted by support on Wed, 2007-11-14 20:45

Hi Mike,

I understand what's happening. The "\" is actually being stripped by the normalise function during import, leaving you with just the "n". In order to do the search and replace successfully, you will need to permit the \ character (stripped because it would break the URLs!). To do this, in includes/admin.php, look for the following code on line 165:

$record[$admin_importFeed["field_description"]] = tapestry_normalise($record[$admin_importFeed["field_description"]],",'\'\.%!");

...and REPLACE this with:

$record[$admin_importFeed["field_description"]] = tapestry_normalise($record[$admin_importFeed["field_description"]],",'\\\'\.%!");

(it looks a bit complicated because \ is also the escape character!)

Now, having done this, the search and replace on "\n" should work fine, however it is very important that you also add another search and replace afterwards (the filters are applied in sequence) for "\" replace with nothing. If the \ character does get into a product name it could cause all sorts of problems in URLs...!

Hope this helps,
Cheers,
David.

Submitted by Mik3 on Wed, 2007-11-14 21:10

Thanks your a star!! Work pefectly.

Thanks very much for your prompt assistance, has saved a few potential bald patches on my head!