Red9 Posted October 3, 2011 Share Posted October 3, 2011 Hello. Need some help guys. How can i remove the manufacturer id from links and rewrite the links, to look something like this: From: www[.]salessite.com/13_michelin to look like www[.]salessite.com/michelin-tires I know i have to rewrite link in .htacces, but i can't manage to modify the code in classes/Link.php The code: public function getManufacturerLink($id_manufacturer, $alias = NULL, $id_lang = NULL) { if (is_object($id_manufacturer)) return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_manufacturer->id).'_'.$id_manufacturer->link_rewrite) : (_PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.(int)($id_manufacturer->id)); if ($alias) return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang)).(int)($id_manufacturer).'_'.$alias) : (_PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.(int)($id_manufacturer)); return _PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.(int)($id_manufacturer); Some help will be appreciated. Thanks in advance Link to comment Share on other sites More sharing options...
Raphaël Malié Posted October 3, 2011 Share Posted October 3, 2011 Hello, sorry but you can't do that, there no native function in prestashop which can check urls without IDs. Regards Link to comment Share on other sites More sharing options...
Red9 Posted October 3, 2011 Author Share Posted October 3, 2011 Actually, you can remove the id. Here's the code: public function getManufacturerLink($id_manufacturer, $alias = NULL, $id_lang = NULL) { if (is_object($id_manufacturer)) return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang))./*intval($id_manufacturer->id).'_'.*/$id_manufacturer->link_rewrite) : (_PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.(int)($id_manufacturer->id)); if ($alias) return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.$this->getLangLink((int)($id_lang))./*intval($id_manufacturer).'_'.*/$alias) : (_PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.intval($id_manufacturer)); return _PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.intval($id_manufacturer); } And now from: www[.]salessite.com/13_michelin, is just www[.]salessite.com/michelin Link to comment Share on other sites More sharing options...
Raphaël Malié Posted October 3, 2011 Share Posted October 3, 2011 Of course you can remove ID, this is not the problem : the problem is that if you click on an URL without ID, Prestashop won't be able to match this URL with a manufacturer page. So you have to add all your new URL in the .htaccess, but this solution is not really efficient Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now