You are here:  » Merchant Name with apostrophe


Merchant Name with apostrophe

Submitted by kend on Thu, 2015-04-09 14:30 in

Hi David,

I need to display a merchant name with an apostrophe. The merchant name is in the feed, e.g. "This Merchant's Name". What is the best way to do this?

The problem is that the apostrophe is stripped during import. I have added a filter field for the merchant name found here: http://www.pricetapestry.com/node/5167, however, this modification will not allow the apostrophe (' or \') to be inserted (search and replace) during import.

Would the manual form (text entry box) for merchant name on the feed registration form allow import with apostrophe? I would test it but have about 25 fields to configure and suspect it's not the right answer.

Thanks!
Ken.

Submitted by support on Thu, 2015-04-09 14:35

Hi Ken,

I know you've been running the script for many years now - please could you let me know which version you are running on this installation and I'll describe the changes required to permit apostrophe as part of the merchant name...

Thanks!

David.
--
PriceTapestry.com

Submitted by kend on Thu, 2015-04-09 15:11

Hi David,

Thank you for quick reply.

Revision 14/06A

Ken.

Submitted by support on Thu, 2015-04-09 15:18

Thanks Ken,

To enable unrestricted manually entered merchant name on Feed Registration (Step 2), in admin/feeds_register_step2.php look for the following code at line 24:

  elseif (($_POST["field_merchant"]=="") && (!preg_match("/^[0-9a-zA-Z\. ]{1,255}$/",$_POST["merchant"])))

...and REPLACE with:

  elseif ($_POST["field_merchant"]=="")

To permit apostrophe during import, in includes/admin.php look for the following code at line 343:

  $importRecord["merchant"] = tapestry_normalise($importRecord["merchant"],"\.");

...and REPLACE with:

  $importRecord["merchant"] = tapestry_normalise($importRecord["merchant"],"\.'");

(very subtle change, just the addition of the apostrophe in the second parameter in the call to tapestry_normalise() which is a list of character to allow)

Finally, to permit inclusion as part of the query submission, in search.php look for the following code at line 6:

  $q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\."):"");

...and REPLACE with:

  $q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\.'"):"");

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by kend on Thu, 2015-04-09 15:27

That took care of it, thank you!

In this case I skipped the manual entry form change, but it's nice to have it here for reference.

Ken.