You are here:  » html in description field

Support Forum



html in description field

Submitted by clare on Thu, 2006-09-28 10:32 in

Hi,
If I put some basic html in the description field of the datafeed i am uploading, will this formatting show on the product pages? For example, if I put in the description field:

blah blah blahblah blah blah

Will I get the line breaks and bolding in the descriptions when they are uploaded or will it just show the tags as text?

Submitted by support on Thu, 2006-09-28 10:40

Hi Clare,

As it stands, HTML along with any other "non safe" characters are removed during the import. The code that does this starts on line 159 of includes/admin.php as follows:

    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"]],",'\'\.%!");
    }

If you are happy to permit HTML, you can simply delete this block of code. The reason I use strip_tags on the description field is that it is not uncommon for merchants to include HTML and in particular links to product info that would therefore bypass your affiliate tracking link!

Cheers,
David.

Submitted by webie on Thu, 2007-05-10 23:04

Hi David,

Is not possible here to enable html description but strip out href or A tags so it remove all links if any in description field.

Also I have some errors in product title where charactor maps are not being removed example would be the inch charactor is there way of cleaning all ilegal charactors from the title it seems to affect mod rewrite on IE?

Example:
120GB Hitachi 2½ inch 5400rpm 8MB PATA
#bargainshack.co.uk/product/120GB-Hitachi-2½-inch-5400rpm-8MB-PATA.html

Submitted by support on Fri, 2007-05-11 07:54

Hi,

What you would need to do here is to change the code to add the second optional parameter $allowable_tags in the call to the strip_tags() function. You would then need to list all the tags you want to permit, but excluding the A tag. To do this, find the code as described in the above modification:

$record[$admin_importFeed["field_description"]] = strip_tags($record[$admin_importFeed["field_description"]]);

...and change it to:

$record[$admin_importFeed["field_description"]] = strip_tags($record[$admin_importFeed["field_description"]],"<i><b><strong><h1><h2><h3><h4><ul><ol><li>");

The illegal characters should be cleared from product names through the call to tapestry_normalise(), however if you are using a character set on your site extended characters are permitted. These normally work OK through mod_rewrite, but there may be some situations in which the product name may be encoded incorrectly. Are there other product names on this site that contain extended characters but work correctly? One solution may be to use the encoding filters on the feed that this product is from. If you are using UTF-8 as your character set (in your $config_charset variable), then try registering a "UTF8 Encode" filter against the product name in this feed. If you are using iso-8859-1, then use "UTF8 Decode"...

Don't forget to import the affected feed again after adding the fitler.

Hope this helps,
Cheers,
David.