You are here:  » Use ISBN number Instead of Product name in URL

Support Forum



Use ISBN number Instead of Product name in URL

Submitted by technoarenasol on Thu, 2013-02-28 13:54 in

Hi David

Change Product URL format like

example.com/books/(isbn no )
example.com/books/43888999992

I already created ISBN13 Numbers field

Thanks
Amin

Submitted by support on Thu, 2013-02-28 16:22

Hi Amin

Sure - whenever changing product URLs, there are just 3 considerations:

1) .htaccess

Look for the following rule at line 7:

RewriteRule ^product/(.*).html$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L]

...and REPLACE with:

RewriteRule ^books/(.*)$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L]

2) tapestry_productHREF() function in includes/tapestry.php

Look for the following code at line 53:

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

...and REPLACE with:

return $config_baseHREF."books/".urlencode(tapestry_hyphenate($product["isbn13"]));

3) SELECT SQL in products.php based on new key

Look for the following code at line 12:

$sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE normalised_name = '".database_safe($q)."'";

...and REPLACE with:

$sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE isbn13 = '".database_safe($q)."'";

Cheers,
David.
--
PriceTapestry.com