Uploaded image for project: 'Prestashop 1.5'
  1. Prestashop 1.5
  2. PSCFV-6542

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

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Security Level: All-users
    • Labels:
      None

      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 <<<<<<<<<<<<<<===============

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vAugagneur Vincent AUGAGNEUR
                Reporter:
                smamet Samuel MAMET
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support