KenFranklin Posted February 12, 2015 Share Posted February 12, 2015 (edited) How to create custom tab in Back-office main menu to my new custom module? Name module: mymodule private function installTab() { $parent_tab = new Tab(); $parent_tab->name = array(); foreach (Language::getLanguages(true) as $lang) $parent_tab->name[$lang['id_lang']] = 'Theme Settings'; $parent_tab->class_name = 'AdminMyModule'; $parent_tab->id_parent = 0; $parent_tab->module = $this->name; $parent_tab->add(); $tab = new Tab(); $tab->name = array(); foreach (Language::getLanguages(true) as $lang) $tab->name[$lang['id_lang']] = 'Theme Settings'; $tab->class_name = 'AdminMyModule'; $tab->id_parent = $parent_tab->id; $tab->module = $this->name; $tab->add(); return true; } I need 1 tab, only parent, but it dont work without $tab = new Tab(); (only Tab and Parent tab). Controller <?php class AdminMyModuleController extends ModuleAdminController { public function __construct() { parent::__construct(); Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules').'&configure=mymodule'); } } 1) Am I right? 2) What right method? 3) How can I make uninstall parentTab and Tab? 4) Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules').'&configure=mymodule') ---->>>> I want to have active Tab of module. Edited February 13, 2015 by workstyling (see edit history) Link to comment Share on other sites More sharing options...
rafapas22 Posted March 9, 2017 Share Posted March 9, 2017 it's work? Link to comment Share on other sites More sharing options...
KenFranklin Posted March 9, 2017 Author Share Posted March 9, 2017 it's work? yes. i have code. work in 1.7 Link to comment Share on other sites More sharing options...
globosoftware.net Posted March 10, 2017 Share Posted March 10, 2017 This is my code to create Menu & Sub Menu on back Office private function _createTab() { $res = true; $tabparent = "AdminGformbuilderpro"; $id_parent = Tab::getIdFromClassName($tabparent); if(!$id_parent){ $tab = new Tab(); $tab->active = 1; $tab->class_name = "AdminGformbuilderpro"; $tab->name = array(); foreach (Language::getLanguages() as $lang){ $tab->name[$lang["id_lang"]] = "Form Builder Pro"; } $tab->id_parent = 0; $tab->module = $this->name; $res &= $tab->add(); $id_parent = $tab->id; } $subtabs = array( array( 'class'=>'AdminGformconfig', 'name'=>'Genaral Settings' ), array( 'class'=>'AdminGformmanager', 'name'=>'Form' ), array( 'class'=>'AdminGformrequest', 'name'=>'Received Data' ), array( 'class'=>'AdminGformrequestexport', 'name'=>'CSV Export' ), ); foreach($subtabs as $subtab){ $idtab = Tab::getIdFromClassName($subtab['class']); if(!$idtab){ $tab = new Tab(); $tab->active = 1; $tab->class_name = $subtab['class']; $tab->name = array(); foreach (Language::getLanguages() as $lang){ $tab->name[$lang["id_lang"]] = $subtab['name']; } $tab->id_parent = $id_parent; $tab->module = $this->name; $res &= $tab->add(); } } return $res; } Link to comment Share on other sites More sharing options...
rafapas22 Posted March 10, 2017 Share Posted March 10, 2017 Thanks now I am investigating how build controller... how render Link to comment Share on other sites More sharing options...
KenFranklin Posted March 10, 2017 Author Share Posted March 10, 2017 good solution. i made controller... class AdminTSConfigController extends ModuleAdminController { public function __construct() { parent::__construct(); Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules').'&configure=templatesettings'); } } Link to comment Share on other sites More sharing options...
Recommended Posts