Jump to content

Recommended Posts

Hello everybody,

I want to modify the current url of the manufacturers from:

http://www.mysite.com/manufacturer23.html

to http://www.mysite.com/manufacturers/manufacturer23.html


I have been trying to modify the classes/link.php and .htaccess, but no success so far...

As concerns the link.php, the files I should modify:



public function getManufacturerLink($id_manufacturer, $alias = NULL)
{

$URLRLPLUS = false;
$modules = Module::getModulesInstalled();
foreach ($modules as $module) {
if ($module['name'] != 'urlrewritingplus')
continue;
$URLRLPLUS = true;
}

if ($URLRLPLUS) {
if ($this->allow == 0)
return _PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.intval($id_manufacturer);
if (is_object($id_manufacturer)) {
if (!$link = Db::getInstance()->ExecuteS('SELECT `id_url`, `type`, `id`, `url` FROM '._DB_PREFIX_.'urlrplus WHERE `type` IN (\'manufacturer\',\'manufacturerauto\') AND `id` = '.intval($id_manufacturer->id)))
return _PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.intval($id_manufacturer->id);
}
else {
if (!$link = Db::getInstance()->ExecuteS('SELECT `id_url`, `type`, `id`, `url` FROM '._DB_PREFIX_.'urlrplus WHERE `type` IN (\'manufacturer\',\'manufacturerauto\') AND `id` = '.intval($id_manufacturer)))
return _PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.intval($id_manufacturer);
}
if (count($link) == 0)
_PS_BASE_URL_.__PS_BASE_URI__.intval($id_manufacturer->id).'-'.$id_manufacturer->link_rewrite;
return __PS_BASE_URI__.$link[0]['url'].'.html';
}


if (is_object($id_manufacturer))
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.intval($id_manufacturer->id).'_'.$id_manufacturer->link_rewrite) :
(_PS_BASE_URL_.__PS_BASE_URI__.'manufacturer.php?id_manufacturer='.intval($id_manufacturer->id));
if ($alias)
return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__.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);
}



Currently, I have for manufacturer23 in .htaccess:

RewriteRule ^manufacturers/manufacturer23\.html(.*)$ manufacturer.php?id_manufacturer=23$1 [QSA,L,E]


Does someone have any idea ?

Many thanks!
Link to comment
Share on other sites

×
×
  • Create New...