Prestashop Core Application V1.5
  1. Prestashop Core Application V1.5
  2. PSCFV-6542

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

    Details

    • Type: Bug Bug
    • Status: Closed 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 <<<<<<<<<<<<<<===============

        Issue Links

          Activity

          Samuel MAMET made changes -
          Field Original Value New Value
          Link This issue duplicates PSCFV-6517 [ PSCFV-6517 ]
          Vincent AUGAGNEUR made changes -
          Assignee Vincent AUGAGNEUR [ vaugagneur ]
          dmetzger made changes -
          Labels Dispatcher SEO url url-rewrite
          Vincent AUGAGNEUR made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Damien Metzger made changes -
          Affected version 1.5.3.0 [ 11890 ] 1.5.3.1 [ 11891 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: