Hi,
I´m trying to make my descriptions look good and in the feeds one description can look like this:
"This is row number one.
This is row number two.
This is row number three."
But after the import the same text looks like this:
"This is row number one. This is row number two. This is row number three."
I´ve tried putting in <br/>
in the description in the feed, but I would guess that is filtered when I import the feed.
Is there any way to keep the formatting?
Another question about the same topic. How do I keep special symbols through the import process? Like it is now characters like ´ and - is replaced with some strange symbol.
Best regards
Daniel
Hi,
Well at first they were just plain breaks, like in a word document, but as that didn´t work I figured I could put in some <br/>
, but that didnt work either. The <br/>
just gets removed when I import the feed.
Hi Daniel,
The script does strip HTML during import, because it is unfortunately common within affiliate datafeeds for merchants to include HTML that links directly to their site within the product description that would bypass your affiliate link.
However, if this is not likely to be a problem, the first thing to do would be to remove both the HTML and normalisation of the description field during import. To do this, within includes/admin.php you will find the following block of code beginning at line 161:
if ($admin_importFeed["field_description"])
{
$record[$admin_importFeed["field_description"]] = strip_tags($record[$admin_importFeed["field_description"]]);
$record[$admin_importFeed["field_description"]] = tapestry_normalise($record[$admin_importFeed["field_description"]],",'\'\.%!");
}
...either delete or comment out this block of code and your description fields will be imported "as is" - so after doing this, check for any side effects such as unwanted HTML...
Cheers,
David.
David that did the trick!
I´m building the feeds myself, so unwanted HTML won´t be a problem!
Thanks,
Daniel
Hi David,
I implemented this solution and it worked very well till now. But my host changed something (of course there is no direct explanation) and evein I deleted block above some characters are lost so I could not get full html code in database.
Example:
it should be:
<div class="box-vsebinaoglasa-big"><table style="width:100%; margin:0 0 0 0; padding:0 0 0 0; border:no ....
but I get.
div class="box-vsebinaoglasa-big"table style="width:100%; margin:0 0 0 0; padding:0 0 0 0; border:no .....
As you can see I lose brackets and with this html page. The problem could be seen already when I try to register new feed.
If I use the same code on my local host it works fine.
Any suggestion?
Thanks, Al
Hi Al,
This sounds like it could be the PHP XML bug described in this thread:
http://www.pricetapestry.com/node/2624
I'll email you an alternative version of Magic Parser containing the work-around...
Cheers,
David.
Might also consider using the Allowed Tags parameter of the strip_tags function. For example:
if ($admin_importFeed["field_description"])
{
$record[$admin_importFeed["field_description"]] = strip_tags($record[$admin_importFeed["field_description"]],"<p><br>");
//$record[$admin_importFeed["field_description"]] = tapestry_normalise($record[$admin_importFeed["field_description"]],",'\'\.%!");
}
I can't verify if this works since the feed I'm working with doesn't have any markup in it (figures), but it's a thought at least!
Details at: http://www.php.net/strip_tags
Has this changed recently? I was hunting around for this code in /includes/admin.php and it's not there. Where else could it be?
Wayman Luy
Hi Wayman,
The latest version of Price Tapestry does not process the description field at all during import (so HTML is not stripped). Instead, a new filter - "Strip HTML" has been added - so if you want to remote all HTML except the <P> and <BR> tags as described above; you could add a new Strip HTML filter to the description field for the affected feed; and in the "Allowable Tags" field enter the tags you wish to permit as described above (the parameter is passed directly to PHP's strip_tags() function).
Cheers,
David.
Hi Daniel,
Do you know how the new lines are represented in the raw data (the feed). Are they HTML (
<br />
) or ASCII new-line characters, i.e. \n (only likely with XML feeds)...?Cheers,
David.