docs
docs copied to clipboard
Adding module links in the back-office side menu is not up to date for v1.7.5
Does not work - please update for PS v1.7.5: https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/tabs/
Hello,
would you mind to share the code that is not working?
Thanks
All parts of the code on this page do not work. Settings of public $tabs
is completely ignored in v1.7.5.
Only this code works via "install" hook in module class:
$tab = new Tab();
$tab->active = 1;
$tab->class_name = $className;
$tab->name = array();
foreach (Language::getLanguages(true) as $lang) {
$tab->name[$lang['id_lang']] = $tabName;
}
$tab->id_parent = (int) Tab::getIdFromClassName($parentClassName);
$tab->module = $moduleName;
$tab->add();
In legacy controllers this should work but not on modern controllers: can you confirm you're trying to add a tab for a legacy controller or a modern ("Symfony") one?
To speak clearly, controller that doesn't extends Module Controllers can't be managed using the public property named $tabs.
Your workaround in the right to do (in the meantime) in the other cases.
Thanks,
yes,my code not working too `class Etalimama extends Module { protected $config_form = false; public $tabs = array( array( 'name' => 'Collect manage', 'class_name' => 'AdminCollectManage', 'visible' => true, 'parent_class_name' => 'SELL', 'icon' => 'material-icons mi-desktop_mac' )); }
I think it's worth mentioning Tab::getIdFromClassName (used in example) is marked as deprecated since 1.7.1
I think the documentation should be modified.
Replace:
(int) Tab::getIdFromClassName('ShopParameters');
by
(int) SymfonyContainer::getInstance()->get('prestashop.core.admin.tab.repository')->findOneIdByClassName('ShopParameters');