David,
I'm trying to allow the apostrophe character in the product title I've added the following to search.php and product.php:
<?php
$q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],"&:'\.\/\(\)\+\,"):"");
?>
<?php
$record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]],"&:'\.\/\(\)\+\,");
?>
If I look int he mysql table for products, I see the ' (apostrophe)in the product names. If I search for the the product I see the full name including the apostrophe showing on the page. eg "Men's Shoes" but when I click the link, I see only the "Men" part shows up in the url. The url is getting cut off at the apostrophe. When I change from using se friendly / htaccess to regular urls it works, but of course I want SE friendly urls. :)
What should I look for in the htaccess to allow the apostrophe in urls? OR is that even what the problem is?
David,
http://www.magazinepriceshopper.com/merchant/Best-Deals-Magazine/9.html shows the magazine names correctly but then click
http://www.magazinepriceshopper.com/product/Arthur-Frommer
You'll see everything after the apostrophe is cut off.
Steve
Hi Steve,
Yes - it's as I thought - the apostrophe is breaking the links in the HTML. Look in your index.php for the following code, where the links for use on the feature products HTML module are generated:
$featured["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";
$featured["products"][$k]["reviewHREF"] = "review/".tapestry_hyphenate($product["name"]).".html";
...and change this to:
$featured["products"][$k]["productHREF"] = htmlentities("product/".tapestry_hyphenate($product["name"]).".html",ENT_QUOTES,$config_charset);
$featured["products"][$k]["reviewHREF"] = htmlentities("review/".tapestry_hyphenate($product["name"]).".html",ENT_QUOTES,$config_charset);
You will also need to make a similar change for the case where product names with ' pop-up in search results. In search.php look for:
$searchresults["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";
...and as above change this to:
$searchresults["products"][$k]["productHREF"] = htmlentities("product/".tapestry_hyphenate($product["name"]).".html",ENT_QUOTES,$config_charset);
That should fix up the HTML...
Cheers,
David.
Hi Steve,
If you are permitting more characters in your product names than the main distribution, it is also important to add html entity conversion to the page TITLE tag.
In search.php, products.php and reviews.php, look for the following code:
$header["title"] = $q;
...and change it to:
$header["title"] = htmlentities($q,ENT_QUOTES,$config_charset);
This will prevent the possibility of characters breaking the HTML.
Cheers,
David.
It sounds like they're breaking the links - an apostrophe would do that if not converted into an HTML entity - which they should be wherever a product name is displayed as part of a link.
Can you post a link to show one that is broken off (email me if you don't want to post it in the forum)...
Cheers,
David.