sqzr Posted November 16, 2015 Share Posted November 16, 2015 (edited) Hello I am attempting to override a module in Prestashop. I have successfully overridden the modules' templates but I cannot successfully overwrite the modules' controller. Where should the new controller class file be placed? I have tried the following locations but they dont add new behaviour (change anything): ~/overrides/modules/blockwishlist/controllers/front/mywishlist.php~/themes/MY_THEME/modules/blockwishlist/controllers/front/mywishlist.php According to my previous question I could do it by editing core classes (suggested kindly by u/Sergii P) but I am sure there is a standard way to do this that doesn't involve editing core classes? For reference; here is the contents of mywishlist.php: <?php if (!defined('_CAN_LOAD_FILES_')) exit; //class BlockWishListMyWishListModuleFrontController extends BlockWishListMyWishListModuleFrontControllerCore // extends ModuleFrontController class BlockWishListMyWishListModuleFrontControllerOverride extends BlockWishListMyWishListModuleFrontController { public function __construct() { parent::__construct(); } /** * Assign wishlist template */ public function assign() { $errors = array(); .... $this->setTemplate('mywishlist.tpl'); } } Edited November 16, 2015 by sqzr (see edit history) Link to comment Share on other sites More sharing options...
omyha Posted December 1, 2015 Share Posted December 1, 2015 Did you find a solution ? Link to comment Share on other sites More sharing options...
bellini13 Posted December 1, 2015 Share Posted December 1, 2015 Where have you read that you can override a modules controller? Link to comment Share on other sites More sharing options...
El Patron Posted December 1, 2015 Share Posted December 1, 2015 see if this blog by nemo1 helps http://nemops.com/override-prestashop-modules-core/#.Vl2klnarTDe Link to comment Share on other sites More sharing options...
bellini13 Posted December 1, 2015 Share Posted December 1, 2015 This tutorial speaks about the Core module file, so I'm still curious where it is documented that you can override a modules controller file? Link to comment Share on other sites More sharing options...
sqzr Posted December 2, 2015 Author Share Posted December 2, 2015 (edited) Did you find a solution ? Where have you read that you can override a modules controller? I came up with a solution that can expand the Block Wishlist module. I've made a blog post that explains how to do it: How to expand a Core Prestashop Module Edited December 2, 2015 by sqzr (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted December 2, 2015 Share Posted December 2, 2015 I came up with a solution that can expand the Block Wishlist module. I've made a blog post that explains how to do it: How to expand a Core Prestashop Module So the answer is that you cannot override a modules controller file, correct? Link to comment Share on other sites More sharing options...
sqzr Posted December 2, 2015 Author Share Posted December 2, 2015 So the answer is that you cannot override a modules controller file, correct? Thats correct. You can still achieve what you want - custom functionality in a core module - using the method I describe in the blog post Link to comment Share on other sites More sharing options...
bellini13 Posted December 2, 2015 Share Posted December 2, 2015 Thats correct. You can still achieve what you want - custom functionality in a core module - using the method I describe in the blog post That's fine, however this topic was specifically opened asking how to override a modules controller. So I wanted to make sure it is clear for users viewing this thread, that the answer is... It is NOT possible. 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