missill Posted November 18, 2016 Share Posted November 18, 2016 Hi everybody, I'd like to override a whole module like "productcomments" module but i don't know how to do. I read official documentation and forum posts about overriding but nothing speaks about the overriding of whole module. I tried to override productcomments controller with path "modules/productcomments/controllers/front/default.php thanks to 3 folders possibilities but nothing working even if i delete cache/class_index.php. - override/modules/productcomments/controllers/front/default.php - themes/mytheme/modules/productcomments/controllers/front/default.php - modules/productcomments/override/controllers/front/default.php I'd like to have an expert answer about overriding module's controller to know if it's possible. I passed too many hours to try and know about it without success. My prestashop version is 1.6.1.7. Thanks for helping me. Alex. Link to comment Share on other sites More sharing options...
fedesib Posted November 18, 2016 Share Posted November 18, 2016 Hi Alex, I think it is possible and you should go with the first possibility: override/modules/productcomments/controllers/front/default.php but then, in default.php your file should start with: class ProductCommentsOverride extends ProductComments { to correctly override the default module behaviour. I hope this will help. Have a nice day, Federica Link to comment Share on other sites More sharing options...
missill Posted November 18, 2016 Author Share Posted November 18, 2016 (edited) Hi and thanks Federica for your answer.I already tried this possibility but without success.Here si the declaration of override/modules/productcomments/controllers/front/default.php that i did : // Include Module include_once(dirname(__FILE__).'/../../productcomments.php'); // Include Models include_once(dirname(__FILE__).'/../../ProductComment.php'); include_once(dirname(__FILE__).'/../../ProductCommentCriterion.php'); class ProductCommentsDefaultModuleFrontControllerOverride extends ProductCommentsDefaultModuleFrontController { ... } Original file is : // Include Module include_once(dirname(__FILE__).'/../../productcomments.php'); // Include Models include_once(dirname(__FILE__).'/../../ProductComment.php'); include_once(dirname(__FILE__).'/../../ProductCommentCriterion.php'); class ProductCommentsDefaultModuleFrontController extends ModuleFrontController { ... } I tried also to remplace these includes with new override path but not working. Nobody tried to override this module or another ? Edited November 18, 2016 by missill (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted November 19, 2016 Share Posted November 19, 2016 You cannot override a modules controller without first customizing core classes to support it http://nemops.com/overriding-modules-controllers-in-prestashop-1-6/#.WC-agSSS-YA 1 Link to comment Share on other sites More sharing options...
fedesib Posted November 21, 2016 Share Posted November 21, 2016 Thanks Bellini for pointing this out, I thought this could be done as a PS core feature. Have a nice day, Federica 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