Hi,
Is there a way to force the product url to be lowercase? at the moment it is for example www.bluewidgets.com/Blue-Widgets
I'd also like to do the same with my meta keywords and force them lowercase currently I'm inserting the product title like so:
$header["meta"]["keywords"] = translate("cheap ").htmlentities($q,ENT_QUOTES,$config_charset).translate(",compare ").htmlentities($q,ENT_QUOTES,$config_charset).translate(",blue,widgets,cheap");
Cheers,
Chris.
Hi David,
One small niggle with this, the banner on my product page is now lowercase also. Is there a way to exclude this from being converted?
Cheers,
Chris.
Hi Chris,
Sure - the banner is currently set by the following code on line 10 of products.php:
$banner["h2"] = translate("Price search results for")." <strong>".htmlentities($q,ENT_QUOTES,$config_charset)."</strong> ";
As it uses $q (which has been strtolower()'d on your site), the trick is to move this line further down the script, and then to use the actual product name from the database. To do this, CUT the above line, and then PASTE it in immediately before the following code which can be found at line 50:
$header["title"] = htmlentities($q,ENT_QUOTES,$config_charset);
...and then MODIFY it as follows:
$banner["h2"] = translate("Price search results for")." <strong>".htmlentities($product["products"][0]["name"],ENT_QUOTES,$config_charset)."</strong> ";
Hope this helps!
Cheers,
David.
Hi Chris,
That would be line 89 of products.php, currently:
$searchresults["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate($related["normalised_name"]).".html";
...REPLACE with:
$searchresults["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate(strtolower($related["normalised_name"])).".html";
Cheers,
David.
What would you change to make the Brand and Merchant names appear lowercase in the URL as well?
Hi,
In categories.php you'll find the line where the rewritten URL is generated as follows (line 20):
$item["href"] = tapestry_hyphenate($product["category"])."/";
...REPLACE with:
$item["href"] = tapestry_hyphenate(strtolower($product["category"]))."/";
And similarly in brands.php, also line 20:
$item["href"] = tapestry_hyphenate($product["brand"])."/";
...REPALCE with:
$item["href"] = tapestry_hyphenate(strtolower($product["brand"]))."/";
Cheers,
David.
Hi Chris,
Sure - regarding the meta tags, simply replace the above code with:
$header["meta"]["keywords"] = translate("cheap ").htmlentities($q,ENT_QUOTES,$config_charset).translate(",compare ").htmlentities(strtolower($q),ENT_QUOTES,$config_charset).translate(",blue,widgets,cheap");
For the product URLs, it should also just be a case of adding strtolower() around the product name wherever a product URL is created, as MySQL text search is not case sensitive. To do this, make the changes a follows:
search.php (line 287):
$searchresults["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate($product["normalised_name"]).".html";
...REPLACE with:
$searchresults["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate(strtolower($product["normalised_name"])).".html";
index.php (line 63 - for Featured Product URLs):
$featured["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate($product["normalised_name"]).".html";
...REPLACE with:
$featured["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate(strtolower($product["normalised_name"])).".html";
...and finally in reviews.php (line 47 - for links back to the product page):
$rows[$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate($row["normalised_name"]).".html";
...REPLACE with:
$rows[$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate(strtolower($row["normalised_name"])).".html";
Hope this helps!
Cheers,
David.