Prestashop Core Application V1.5

URL routes format cannot be redefined (category, product, manufacturer, ...)

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Resolution: Fixed
  • Security Level: All-users
  • Labels:
    None
  • Similar issues:
    PSCFV-5722 No category name in product URL
    PSCFV-4191 remove .html from 'Route to products'
    PSCFV-4978 In route to product is variable "category" not working with friendy URL enabled - SEO & URL
    PSCFV-6517 Dispatcher->loadRoutes replaces all custom routes with defaults
    PSCFV-6561 default url changes
    PSCFV-3841 'There is 1 error Product not found' when .html is removed from' Route to category' - SEO & URLS
    PSCFV-5995 no category id in product url (product-list.tpl)
    PSCFV-9509 getProductLink() does not take custom routes into account when called in back-office module
  • Affected version:
    1.5.3.0

Description

The new release 1.5.3.1 & 1.5.3.0 are impacted :

You cannot change the route formats in section SEO & URLS for products, categorie, manufacturers, etc...
I went thought the code and here is the FIX :

The problem is caused because the module hook route overrides are overridden by the default routes in function loadRoutes() in Dispatcher.php. The code loading defaults should be placed just under the hookExec.

====
File classes/Dispatcher.php line 441 :
====

// Set default routes
foreach (Language::getLanguages() as $lang)
foreach ($this->default_routes as $id => $route)
$this->addRoute(
$id,
$route['rule'],
$route['controller'],
$lang['id_lang'],
$route['keywords'],
isset($route['params']) ? $route['params'] : array()
);

===
This code was put at the wrong place. Move it under line 397 :
===

// Load custom routes from modules
$modules_routes = Hook::exec('moduleRoutes', array(), null, true, false);
if (is_array($modules_routes) && count($modules_routes))
foreach($modules_routes as $module_route)
foreach($module_route as $route => $route_details)
if (array_key_exists('controller', $route_details) && array_key_exists('rule', $route_details)
&& array_key_exists('keywords', $route_details) && array_key_exists('params', $route_details))

{ if (!isset($this->default_routes[$route])) $this->default_routes[$route] = array(); $this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details); }

===========>>>>>>> Place previous code here <<<<<<<<<<<<<<===============

Issue Links

Activity

Samuel MAMET made changes - 09/Jan/13 9:29 AM
Field Original Value New Value
Link This issue duplicates PSCFV-6517 [ PSCFV-6517 ]
Vincent AUGAGNEUR made changes - 09/Jan/13 10:46 PM
Assignee Vincent AUGAGNEUR [ vAugagneur ]
Damien METZGER made changes - 15/Jan/13 5:06 PM
Labels Dispatcher SEO url url-rewrite
Vincent AUGAGNEUR made changes - 15/Jan/13 5:29 PM
Status Open [ 1 ] Closed [ 6 ]
Resolution Fixed [ 1 ]

People

Vote (1)
Watch (1)

Dates

  • Created:
    09/Jan/13 12:03 AM
    Updated:
    07/Feb/13 8:39 AM
    Resolved:
    15/Jan/13 5:29 PM