Gary - WIC Posted July 21, 2015 Share Posted July 21, 2015 Hi ! Is there a way to override a ModuleFrontController from a module ? I know that is possible to override a module main file via override/modules folder, but is it possible to override a frontcontroller for a specific module ? (In my case I need to override LoyaltyDefaultModuleFrontController) Thanks for any help, Gary Link to comment Share on other sites More sharing options...
vekia Posted July 21, 2015 Share Posted July 21, 2015 i know that is not a perfect solution, but you can duplicate this controller, change its name and in other files change original controller name to your duplicated one you will avoid problems with module upgrade then :-) Link to comment Share on other sites More sharing options...
alexdee2007 Posted February 23, 2016 Share Posted February 23, 2016 Put this file into override/classes/. Then delete cache/class_index.php This allow override front controller of modules. Example: override/modules/productscomment/controllers/front/default.php class ProductCommentsDefaultModuleFrontControllerOverride extends ProductCommentsDefaultModuleFrontController { .............. } Tested on PS 1.6.1.4 Sorry for my bad english. Best regards, Alex. Dispatcher.zip 1 Link to comment Share on other sites More sharing options...
acuarelweb Posted February 25, 2016 Share Posted February 25, 2016 (edited) Thx for the script alexdee2007, Tried it, however ¿how should i modify it to be able to override an module adminController? I want to override modules/mymodule/controllers/admin/AdminMyModuleSomeController.php Class name in this file: class AdminMyModuleSomeController.php extends ModuleAdminController {... My override file: class AdminMyModuleSomeControllerOverride extends AdminMyModuleSomeController {... Also i need to override main php file so i put the override file in /override/modules/mymodule/mymodule.php Then: - i've copied Dispatcher.php to /override/classes/ - i've copied override file to /override/modules/mymodule/controllers/admin/AdminMyModuleSomeController.php - delete class_index.php from cache ¿is that right? I'm afraid im losing something here cause it does not work Thx in advance!! Edited February 25, 2016 by acuarelweb (see edit history) Link to comment Share on other sites More sharing options...
alexdee2007 Posted February 25, 2016 Share Posted February 25, 2016 Hello! This feature allows to override only Front Controllers, not Admin Controller. If you need override Admin Controller, i have been made some changes in file Dispatcher.php. Also you need put file AdminController.php into override/classes/controller Then delete cache/class_index.php This allow override front and admin controllers of modules. Best regards, Alex. override.zip 1 Link to comment Share on other sites More sharing options...
acuarelweb Posted March 30, 2016 Share Posted March 30, 2016 Ok. Now it seems to work thank you very much, mate!! 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