Jump to content

need help to fix meta links (controller<->dispatch) while 1.5 theme tested on ps 1.6


Gökmen

Recommended Posts

Hello to all!
 
I can say I'm new in prestashop :) and also not sure if i open the topic in the right place as well. If not sorry!

 

I have an url-rewrite issue:
 
I test a 1.5 theme on ps 1.6. So far everything seems to work fine except the url-rewrite feature.
 
If i disable the url-rewrite everything still works fine but when i enable it products, categories.. links still work but not the meta-links like: contact-us, sitemap etc..

 

When i change _PS_MODE_DEV_ to 'true'  in defines.inc and get the  error message on browser i see the following on browser: "Notice: Undefined index: controller in /var/www/vhosts/example.com/httpdocs/classes/Dispatcher.php on line 756"
 
The mentioned part in dispather.php is as follows: (line 756 in red)
 
        // Use routes ? (for url rewriting)
        if ($this->use_routes && !$controller && !defined('_PS_ADMIN_DIR_'))
        {
            if (!$this->request_uri)
                return strtolower($this->controller_not_found);
            $controller = $this->controller_not_found;
            
            // If the request_uri matches a static file, then there is no need to check the routes, we keep "controller_not_found" (a static file should not go through the dispatcher)
            if (!preg_match('/\.(gif|jpe?g|png|css|js|ico)$/i', parse_url($this->request_uri, PHP_URL_PATH)))
            {
                // Add empty route as last route to prevent this greedy regexp to match request uri before right time
                if ($this->empty_route)
                    $this->addRoute($this->empty_route['routeID'], $this->empty_route['rule'], $this->empty_route['controller'], Context::getContext()->language->id, array(), array(), $id_shop);

                if (isset($this->routes[$id_shop][Context::getContext()->language->id]))
                    foreach ($this->routes[$id_shop][Context::getContext()->language->id] as $route)
                        if (preg_match($route['regexp'], $this->request_uri, $m))
                        {
                            // Route found ! Now fill $_GET with parameters of uri
                            foreach ($m as $k => $v)
                                if (!is_numeric($k))
                                    $_GET[$k] = $v;
        
                            $controller = $route['controller'] ? $route['controller'] : $_GET['controller'];
                            if (!empty($route['params']))
                                foreach ($route['params'] as $k => $v)
                                    $_GET[$k] = $v;
        
                            // A patch for module friendly urls
                            if (preg_match('#module-([a-z0-9_-]+)-([a-z0-9]+)$#i', $controller, $m))
                            {
                                $_GET['module'] = $m[1];
                                $_GET['fc'] = 'module';
                                $controller = $m[2];
                            }
        
                            if (isset($_GET['fc']) && $_GET['fc'] == 'module')
                                $this->front_controller = self::FC_MODULE;
                            break;
                        }
            }
            
            if ($controller == 'index' || $this->request_uri == '/index.php')
                $controller = $this->useDefaultController();
        }

        $this->controller = str_replace('-', '', $controller);
        $_GET['controller'] = $this->controller;
        return $this->controller;
    }
 
 
I guess that it's about controllers differences between 1.5 and 1.6 maybe!? but have no idea how to fix it... I need help to correct this dispatcher / controller issue.

 

Due to this problem i also can't use the gsitemap module because it creates the products urls with url-rewrite (and still not correctly :wacko: but i guess this is another topic itself, anyway..) and the rest (meta links) without rewrite :wacko:. After reading a lot about the gsitemap module i decided to handle that problem seperately :)

 

Any idea/help is appreciated!
 

p.s. sorry for my english level :)

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