You are here:  » Lowercase urls

Active Forum Topics


Lowercase urls

Submitted by IG on Wed, 2015-03-18 13:03 in

Hi David

I have started a new project and I am trying to make all urls lowercase. I have successfully made the necessary changes in tapestry.php for product and review urls, but I cannot figure out how to make brand, category and merchant urls lowercase as well. I followed some older threads, but without success. Can you please point me in the right direction. I am using 1501A.

Cheers, IG

Submitted by support on Wed, 2015-03-18 14:06

Hello IG,

There is a new function in includes/tapestry.php that generates the merchant / category / brand URLs - look for this code at line 317:

  $href .= tapestry_hyphenate($entry)."/";

...and REPLACE with:

  $href .= strtolower(tapestry_hyphenate($entry))."/";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Wed, 2015-03-18 14:25

It helps and it makes sense, but somehow it doesn't work.

Submitted by support on Wed, 2015-03-18 14:36

Hello IG,

That's strange - I just doubled checked on my test server, but I wonder if some of the changes you made from other threads meant the code in the calling files (merchants.php etc.) was no longer using the tapestry_indexHREF() function. Could you perhaps retry with just this modification in place and the 15/01 distribution versions of merchants.php, categories.php and brands.php?

Let me know if still not sure and I'll check it our further for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Wed, 2015-03-18 15:36

Hi David

I figured it out. This issue was related to the theme I am using. The urls are now all lowercase as needed, but unfortunately they also show in lowercase on the site. I will first try to figure this one out without your help.

On another note, where do I change /category/, /brand/ and /merchant/ to something else in the 15/01? It is clear that I need to change .htacess, but are there any other files?

Cheers, IG

Submitted by support on Wed, 2015-03-18 15:55

Hi IG,

The same, new tapestry_indexHREF() function in includes/tapestry.php also creates the A-Z links for merchant / category / brand however this is new for 15/01A so your theme may well be creating the links hard coded to merchant/ category/ and brand/ as per 14/06A - if that's the case you should find them either in your index.php file or for links created in the header in html/header.php. Simply edit to correspond with similar changes in .htaccess and then in includes/tapestry.php you'll find the following code:

    $indexHREF["merchant"][TRUE] = "merchant/";

    $indexHREF["category"][TRUE] = "category/";

and

    $indexHREF["brand"][TRUE] = "brand/";

...at lines 301, 305, and 309 respectively. Simply edit these to correspond with your changes to .htaccess as required.

Regarding lower cased values now appearing in the page output, this will be down to the use of $q so what you could do very easily is to apply a ucwords() call to this at the top of 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(ucwords($_GET["q"]),":\.\/"):"");

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Sat, 2015-03-28 10:06

Hi David

ucwords helps to make all first letters of a product capital. However, I was wondering if there is a way to use the original capitalization of the product feed in some places.

For example, instead of using ucwords($q) for meta titles, I would prefer to use the actual feed product title. Can this be done without any negative consequence? And more important how?

Kind regards and happy weekend,
IG

Submitted by support on Sat, 2015-03-28 11:10

Hello IG,

Sure - in products.php, look for the following code at line 64:

  $header["title"] = $q;

...and REPLACE with:

  $header["title"] = $product["products"][0]["name"];

Cheers,
David.
--
PriceTapestry.com

Submitted by TWDesigns on Sat, 2018-03-10 18:29

Does this still hold true with version 15 and 16? I made the change at the begining but my URLs are still uppercase.

Submitted by support on Mon, 2018-03-12 11:49

Hi,

For 16/10A, edit includes/tapestry.php and look for the following code at line 325:

        $href .= tapestry_hyphenate($entry)."/";

...and REPLACE with:

        $href .= strtolower(tapestry_hyphenate($entry))."/";

Cheers,
David.
--
PriceTapestry.com

Submitted by TWDesigns on Thu, 2018-03-22 12:20

What else could cause this not to work? I have made the change but the URLs are still Cap cased or uppercase.

Thanks

Submitted by support on Thu, 2018-03-22 12:53

Hi Tommy,

The above would only apply to the merchant / category / brand search URLs - if they are still not being made lower case let me know and I'll check that out further with you. For standalone Price Tapestry, for product pages edit includes/tapestry.php and look for the following code at line 66:

      return $config_baseHREF."product/".urlencode(tapestry_hyphenate($product["normalised_name"])).".html";

...and REPLACE with:

      return $config_baseHREF."product/".urlencode(strtolower(tapestry_hyphenate($product["normalised_name"]))).".html";

And for review pages, look for the following code at line 82:

      return $config_baseHREF."review/".urlencode(tapestry_hyphenate($product["normalised_name"])).".html";

...and REPLACE with:

      return $config_baseHREF."review/".urlencode(strtolower(tapestry_hyphenate($product["normalised_name"]))).".html";

Cheers,
David.
--
PriceTapestry.com