You are here:  » Global Filter Product Name

Support Forum



Global Filter Product Name

Submitted by philstone on Fri, 2009-12-11 09:21 in

Hi David

is it possible to have a global Filter for product names?

eg to replace all "&" with "and"?

thanks
phil

Submitted by support on Fri, 2009-12-11 09:27

Hi Phil,

Sure - in the new version, in includes/admin.php look for the following code beginning at around line 271:

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

...and REPLACE with:

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

Hope this helps!

Cheers,
David.

Submitted by philstone on Fri, 2009-12-11 10:49

thanks david, works great, wondering if there is a way to do it that it changed the url as amp still appears?

i'll explain the problem i'm having on the site with a few different installations of the feed

product in question for this example: Love Fashion and Friends (Element Girls) - its a ds game

if you go to this search results page and click the product "Love Fashion and Friends (Element Girls)" it brings you to this page "http://www.buy24-7.net/ds/Love-Fashion-amp-Friends-Element-Girls.html"

if your on the product page for: http://www.buy24-7.net/ds/Diva-Girls-Diva-Dancers.html

down at the related items section at the bottom of the page
http://www.buy24-7.net/ds/Love-Fashion-and-Friends-(Element-Girls).html

this page comes up product not found, when i redirect the related page to use searchresults.php the same problem occurs, this is what happens after using the above admin.php code change, but the same happened beforehand

hope you can make sense of this david

thanks
phil

Phil Stone
www.buy24-7.net

Submitted by support on Fri, 2009-12-11 11:08

Hi Phil,

That implies that they are encoded as entities rather than as the & character on its own (or at least in some cases). To fix this, use the following as a complete replacement for the block of code above:

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

Hope this helps!

Cheers,
David.

Submitted by philstone on Fri, 2009-12-11 11:39

thanks David!!!