You are here:  » Weird search and replace behaviour after removing apostrophes


Weird search and replace behaviour after removing apostrophes

Submitted by Pidea on Wed, 2013-09-25 20:55 in

Hi David, I'm running an old version of Price Taptestry (12/10A) and I'm getting weird behaviour on the search and replace filter.

I'm pulling in a feed which contains Men's, Women's and Child's in the product name. I've applied a patch I found somewhere on here to remove the apostrophes. I added the following code to includes/admin.php:

$importRecord["name"] = str_replace("'", "", $importRecord["name"]);
/* create normalised version of product name for use in URLs */
$normalisedName = tapestry_normalise($importRecord["name"]);

and that certainly removes the apostrophes but when I then try to do a search and replace on the resulting Mens, Womens or Childs it fails. Yet replacing Men, Women or Child works so it's as if there's some extra character before the s.

Any ideas what's going on ?

Thanks in advance

Phil

Submitted by support on Thu, 2013-09-26 08:03

Hi Phil,

Filters are actually applied before that point in the code. One option, rather than a code modification would be to add a Global Filter to the Product Name field with a search for apostrophe and leave replace blank.

However to keep it as a code mod, if you move the line that you added higher up the same function - look for the following comment:

  /* apply user filters */

...and insert it just above that line - the replacement will then happen before filters...

Cheers,
David.
--
PriceTapestry.com