beginner1 Posted October 23, 2017 Share Posted October 23, 2017 Hi everyone, I am developing a module and I want to create a custom navigation bar in the backoffice. How can I accomplish that? Link to comment Share on other sites More sharing options...
Involic Posted October 23, 2017 Share Posted October 23, 2017 Hello! Are you talking about toolbar like this ? You can do this in "Tab" class that extends ModuleAdminController Please take a look at function public function initPageHeaderToolbar() You can add your own menu item like this $this->page_header_toolbar_btn['new_carrier'] = array( 'href' => $this->context->link->getAdminLink('AdminCarriers').'&onboarding_carrier', 'desc' => $this->l('Add new carrier', null, null, false), 'icon' => 'process-icon-new' ); So function could look like this (this is example from AdminCarriersControllerCore): public function initPageHeaderToolbar() { $this->page_header_toolbar_title = $this->l('Carriers'); if ($this->display != 'view') { $this->page_header_toolbar_btn['new_carrier'] = array( 'href' => $this->context->link->getAdminLink('AdminCarriers').'&onboarding_carrier', 'desc' => $this->l('Add new carrier', null, null, false), 'icon' => 'process-icon-new' ); } parent::initPageHeaderToolbar(); } Link to comment Share on other sites More sharing options...
beginner1 Posted October 23, 2017 Author Share Posted October 23, 2017 (edited) 6 hours ago, Involic said: Hello! Are you talking about toolbar like this ? You can do this in "Tab" class that extends ModuleAdminController Please take a look at function public function initPageHeaderToolbar() You can add your own menu item like this $this->page_header_toolbar_btn['new_carrier'] = array( 'href' => $this->context->link->getAdminLink('AdminCarriers').'&onboarding_carrier', 'desc' => $this->l('Add new carrier', null, null, false), 'icon' => 'process-icon-new' ); So function could look like this (this is example from AdminCarriersControllerCore): public function initPageHeaderToolbar() { $this->page_header_toolbar_title = $this->l('Carriers'); if ($this->display != 'view') { $this->page_header_toolbar_btn['new_carrier'] = array( 'href' => $this->context->link->getAdminLink('AdminCarriers').'&onboarding_carrier', 'desc' => $this->l('Add new carrier', null, null, false), 'icon' => 'process-icon-new' ); } parent::initPageHeaderToolbar(); } Hi, how can I do this from a module? I want to implement it in my module's backoffice. Edited October 23, 2017 by beginner1 (see edit history) Link to comment Share on other sites More sharing options...
Involic Posted October 23, 2017 Share Posted October 23, 2017 1 hour ago, beginner1 said: Hi, how can I do this from a module? I want to implement it in my module's backoffice. 1 The part of code that I give you previusly is could be used also in the module. So simple module contains only one file "modulename.php". Additionally you will be need to register controller/tab I can't find any point to documentation. But very similar question/answer in SO - https://stackoverflow.com/questions/15027548/prestashop-custom-tab-in-back-office So you will have YourAdminControllerName Inside it you will be possible apply this code (adding menu). As an example, you can take a look into few existing modules. For example themeconfigurator . You can find controller under /modules/themeconfigurator/controllers/ Link to comment Share on other sites More sharing options...
beginner1 Posted October 24, 2017 Author Share Posted October 24, 2017 (edited) 4 hours ago, Involic said: The part of code that I give you previusly is could be used also in the module. So simple module contains only one file "modulename.php". Additionally you will be need to register controller/tab I can't find any point to documentation. But very similar question/answer in SO - https://stackoverflow.com/questions/15027548/prestashop-custom-tab-in-back-office So you will have YourAdminControllerName Inside it you will be possible apply this code (adding menu). As an example, you can take a look into few existing modules. For example themeconfigurator . You can find controller under /modules/themeconfigurator/controllers/ Can you tell me how do I know that a controller is working or not? The module.php file is the one that actually loads up so how do I know that the controller is working? I made a controller but I don't know whether it is working or not. The only statement about the controller in the some other file is: $this->controllers = array('myController'); I have written this in my module.php file. Apart from this I haven't given a reference anywhere about myController. Is this the only thing required for running the controller in the module? Edited October 24, 2017 by beginner1 (see edit history) 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