You are here:  » Ampersand code in CSV incorrectly added to db


Ampersand code in CSV incorrectly added to db

Submitted by BillM on Thu, 2009-09-10 11:31 in

Hi David,

Some merchant feeds I use contain the ampersand code & When the code is inserted into the product table it reads amp - which obviously will not then render on screen as the intended & symbol.

Is there a method you could suggest that will insert the & exactly as that into the db?

Thanks for your thoughts

Bill

Submitted by support on Thu, 2009-09-10 11:34

Hi Bill,

It's the field normalisation that is removing & and ; leaving just amp. They can be safely permitted in the description field. In includes/admin.php, the description field is "normalised" on line 165 as follows:

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

...to permit HTML entities, replace this line with:

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

Cheers,
David.

Submitted by BillM on Thu, 2009-09-10 13:05

Thanks David.

Submitted by crounauer on Wed, 2011-10-12 21:33

Hi David,

I have had a look at http://www.pricetapestry.com/node/2997 to try and sort out the merchant B&Q as being displayed as B amp Q, but I cannot find the relevant line. Could you point me in the right direction please?

I am using version 12/10B

Thanks,
Simon

Submitted by crounauer on Wed, 2011-10-12 21:38

Hi David,

I think I found it, change line 335 in admin.php from
$importRecord["merchant"] = tapestry_normalise($importRecord["merchant"],"\.");
to
$importRecord["merchant"] = tapestry_normalise($importRecord["merchant"],",'\'\.%!&#;");

Thanks, Simon

Submitted by support on Thu, 2011-10-13 07:04

Hi Simon,

That's it - the & and ; allow the full HTML entity for the ampersand to be imported but double check it hasn't had any side effects in the URL = browse to /merchant/ and then click your B&Q link to confirm that all is OK in the URL...

Cheers,
David.
--
PriceTapestry.com

Submitted by ChrisNBC on Mon, 2014-07-21 13:32

HI David,

Hope all is goign well.

I have just made the mod you describe in your post to Simon above. The mod has resolved the 'k&' issue. However, when I click on the B&Q logo from within merchants or a products page it now results in the message "Product search results for merchant:B (no results found)". I wondered if you could sugegst how this might be resolved?

Thanks in advance.

Regards
Chris

Submitted by support on Mon, 2014-07-21 13:39

Hi Chris,

Even though ordinarily URL safe by default the merchant name is urlencoded where used in the URL in the latest distributions but I know you're running an earlier version that has been quite heavily modified, so if you'd like to email me your

merchants.php
products.php

...i'll check that out for you...

Cheers,
David.
--
PriceTapestry.com