Jump to content

Help me with removing manufacturer ID from link


Red9

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...