Jump to content

[SOLVED] Adding custom tab on AdminProducts


AmineDev

Recommended Posts

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 by AmineDev (see edit history)
Link to comment
Share on other sites

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

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 :)

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...