AmineDev Posted May 6, 2014 Share Posted May 6, 2014 (edited) Hello Prestashop community, I am trying to develop a module that adds a new Tab on the product Add/Update Admin page. I managed to add the tab using displayAdminProductsExtra hook. I added some content there using the form helper. The problem is that the actionProductUpdate is not fired when I click the submit button on that tab. I thought I could use that hook (actionProductUpdate) to store the form data, but it's not working. I then thought about creating my own AdminController to handle that but I can't find any good documentation on how to extend that class. So can anyone tell me please how to porcess the form data ? I am working on prestashop 1.6 and I really need your help. Thanks. Edited May 6, 2014 by AmineDev (see edit history) Link to comment Share on other sites More sharing options...
Fabien Serny Posted May 6, 2014 Share Posted May 6, 2014 Hi, Why don't you use the same hook ("displayAdminProductsExtra") to store the form data ? When you click on the submit button of you tab, the same page will reload with your POST values. 1 Link to comment Share on other sites More sharing options...
AmineDev Posted May 6, 2014 Author Share Posted May 6, 2014 Thanks a million Fabien ! It worked. The trick is so obvious, I wonder why I didn't think of it before. Thanks again. Link to comment Share on other sites More sharing options...
Fabien Serny Posted May 6, 2014 Share Posted May 6, 2014 No problem Don't forget to update your topic subject with [sOLVED] Link to comment Share on other sites More sharing options...
AmineDev Posted May 7, 2014 Author Share Posted May 7, 2014 No problem Don't forget to update your topic subject with [sOLVED] Hello again, The original problem is solved, now I just need a way to make a class with all the functions I need and then call them in the module php file, do you know how to do that ? I am asking this because the module php file is getting messed up. Thanks. Link to comment Share on other sites More sharing options...
Fabien Serny Posted May 7, 2014 Share Posted May 7, 2014 Hi, Here's a simple solution : public function hookDisplayAdminProductsExtra() { // Replace YourModule with your module name require_once('classes/YourModuleDisplayAdminProductsExtra.php'); $hook = new YourModuleDisplayAdminProductsExtra(); $hook->process(); $hook->display(); } And in your module directory, in a directory named "classes" or "hooks" or whatever you want, you create a file named "YourModuleDisplayAdminProductsExtra.php" which contains : class YourModuleDisplayAdminProductsExtra { public function process() { // Store post datas } public function display() { // Display } } That's one of the many solution you can apply 1 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