Question

I am writing a module, I know how to build a global module, but I would like to do the following:

  • Have global properties (already covered)
  • Have the same properties in a tab in the products interface in the admin where the user can override the global properties (still to do)

Now my question:

  • How do I add an additional tab to the products interface in the prestashop admin?
  • I guess I can easily call these in my module templates and check if global is overridden?

Thanks for the feedback, Eric

PS. Using prestashop 1.5.8, will worry later to extend to 1.6

Was it helpful?

Solution

To add an additional tab to product edit page, you can use hookDisplayAdminProductsExtra.

First, you will have to register this hook inside install() method:

public function install() {
   ...
   $this->registerHook('displayAdminProductsExtra')...
   ...
}

after that you define this:

public function hookDisplayAdminProductsExtra($params) {
...
return $this->display(__FILE__, 'views/admin/yourtemplatefile.tpl');
}

File yourtemplatefile.tpl defines the contents of your extra tab. Extra variables used in this file can be assigned inside hookDisplayAdminProductsExtra function

Here you can find additional information about creating a module: http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module

And here you can find information about hooks: http://doc.prestashop.com/display/PS15/Hooks+in+PrestaShop+1.5

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top