Slayem Posted October 26, 2022 Share Posted October 26, 2022 (edited) Hello, I create new sub-menu in BO customer menu as -- Customers -- Customers -- Addresses -- MySubmenu I displayed when user click in "MySubmenu" the same page as Customers, I put in the class_name of the tab : $tab->class_name = 'AdminCustomers'; IT's OK, The list of customer appears when user click on MySubmenu But then i modify my code to assign in "MySubmenu" new class name , but the Origin sub menu "Customers" of BO not workin and display The page is not redirected correctly -- Customers -- Customers --> display error The page is not redirected correctly -- Addresses -- MySubmenu any one have an Idea to resolved this regression in service customers BO page. My Module code : <?php if (!defined('_PS_VERSION_')) { exit; } class commission extends Module { public function __construct() { $this->name = 'myModule'; $this->tab = 'administration'; $this->version = '1.0.0'; $this->author = 'Developpers'; $this->need_instance = 0; $this->ps_versions_compliancy = [ 'min' => '1.7.1', 'max' => '1.7.9', ]; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('MyModule'); $this->description = $this->l('My Model description'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('MYMODULE_NAME')) { $this->warning = $this->l('No name provided'); } } public function install() { $this->installTab(); return parent::install(); } public function uninstall() { $this->uninstallTab(); return parent::uninstall(); } private function installTab() { $tabId = (int) Tab::getIdFromClassName('AdminMyModule'); if (!$tabId) { $tabId = null; } $tab = new Tab($tabId); $tab->active = 1; //$tab->class_name = 'AdminMyModule'; $tab->class_name = 'AdminCustomers'; // I changed it to AdminMyModule // Only since 1.7.7, you can define a route name //$tab->route_name = 'admin_my_symfony_routing'; $tab->name = array(); foreach (Language::getLanguages() as $lang) { $tab->name[$lang['id_lang']] = $this->trans('Commission', array(), 'Modules.Commission.Admin', $lang['locale']); } $tab->id_parent = Tab::getIdFromClassName('AdminParentCustomer'); $tab->module = $this->name; return $tab->save(); } private function uninstallTab() { $tabId = (int) Tab::getIdFromClassName('AdminMyModule'); if (!$tabId) { return true; } $tab = new Tab($tabId); return $tab->delete(); } } I used prestashop 1.7.7.2 Thanks in advance Edited October 26, 2022 by Slayem (see edit history) Link to comment Share on other sites More sharing options...
Slayem Posted October 26, 2022 Author Share Posted October 26, 2022 (edited) I named the class_name another timeof my module AdminCustomers as followin--> $tab->class_name = 'AdminCustomers'; and I install the model There is the content in ps_tabs in my data base : ==> the tab customer is work and display the list of customer I deleted the second row, the commission tab is deleted from the BO interface and the tab customer is worked fine. But why if i desactivate my module the sub-tab customer in the BO not working ? Is there a problem in the redirection of the class_name="adminCustomers" and the routes in prestashop BO ? Did the fact that I added a module with an existing class_name affect the core of redirection pages of prestashop? There is the result : Thanks; Salem Edited October 26, 2022 by Slayem (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