flobrflo Posted March 24, 2014 Share Posted March 24, 2014 Hi, i would like to use ModuleRoute for my module in presta 1.6. i try to use : In mymodule.php public static $ModuleRoutes = array( 'route-name' => array( 'controller' => null, 'rule' => '{module}/{/:controller}', 'keywords' => array( 'module' => array('regexp' => 'modulename', 'param' => 'module'), 'controller' => array('regexp' => 'controllerfile', 'param' => 'controller') ), 'params' => array( 'fc' => 'module' ) ) ); and the hook : public function hookModuleRoutes() { return self::$ModuleRoutes; } In my controller file: public function initContent() { parent::initContent(); $this->context->smarty->assign('message', $this->message); $this->setTemplate('view_execution.tpl'); } but when i try to access to: http://mydomain.com/modulename/controllerfile , got a 404 and can't access to my route. Help =D Link to comment Share on other sites More sharing options...
Krystian Podemski Posted March 24, 2014 Share Posted March 24, 2014 Go to Preferences -> Performance and see if you have enabled overrides and non native modules, I have this issue yesterday and... I couldn't change this setting from back-office :/ I had to place additional code in module constructor (yeah, lame method) Link to comment Share on other sites More sharing options...
flobrflo Posted March 24, 2014 Author Share Posted March 24, 2014 both are enabled. No error on install, just... Presta totaly don't care xD Link to comment Share on other sites More sharing options...
Krystian Podemski Posted March 24, 2014 Share Posted March 24, 2014 Enabled? Both are green or red? Should be red. Link to comment Share on other sites More sharing options...
flobrflo Posted March 24, 2014 Author Share Posted March 24, 2014 ther are red xD Link to comment Share on other sites More sharing options...
flobrflo Posted March 24, 2014 Author Share Posted March 24, 2014 (edited) Hey, now i got the error : Dispatcher::createUrl() miss required parameter "module" for route "route-name" Edited March 24, 2014 by flobrflo (see edit history) Link to comment Share on other sites More sharing options...
Krystian Podemski Posted March 24, 2014 Share Posted March 24, 2014 Yep. below "fc" add param with your module name, module => 'my-module' Link to comment Share on other sites More sharing options...
flobrflo Posted March 24, 2014 Author Share Posted March 24, 2014 add : 'params' => array( 'module' => 'module-name', 'fc' => 'module' ) but same error. i just need 1 url, so i writte : 'route-name' => array( 'controller' => null, 'rule' => 'module-name/controller-name', ) and that's work... don't understand why with params i get errors.. Link to comment Share on other sites More sharing options...
Denis Gerasimov Posted July 7, 2014 Share Posted July 7, 2014 Hello, same problem here, but i finally got module custom routes to work. See my post - http://www.prestashop.com/forums/topic/342413-module-routes/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now