Prestashop - 在管理菜单下为我的模块添加自定义菜单项
Prestashop - add a custom menu item for my module under admin menu
我的问题是:
如何通过代码在 pestashop 后台的订单菜单(例如)下为我的 prestashop 模块添加自定义菜单项?
您可以在模块安装功能上添加一个菜单项。
$currentid = Tab::getIdFromClassName('YOUR_ADMINCLASS');
if (!$currentid ) {
$tab = new Tab();
$tab->active = 1;
$tab->class_name = "YOUR_ADMINCLASS";
$tab->name = array();
foreach (Language::getLanguages() as $lang){
$tab->name[$lang['id_lang']] = "DISPLAYNAME";
}
$tab->id_parent = $parentTabid;
$tab->module = $this->name;
$tab->add();
}
要作为子菜单或订单放置,请搜索 $parentTabid
:
$sql = "SELECT `id_tab` FROM `"._DB_PREFIX_."tab` WHERE `class_name` LIKE 'AdminParentOrders'";
$parentTabid = Db::getInstance()->getValue($sql);
我的问题是:
如何通过代码在 pestashop 后台的订单菜单(例如)下为我的 prestashop 模块添加自定义菜单项?
您可以在模块安装功能上添加一个菜单项。
$currentid = Tab::getIdFromClassName('YOUR_ADMINCLASS');
if (!$currentid ) {
$tab = new Tab();
$tab->active = 1;
$tab->class_name = "YOUR_ADMINCLASS";
$tab->name = array();
foreach (Language::getLanguages() as $lang){
$tab->name[$lang['id_lang']] = "DISPLAYNAME";
}
$tab->id_parent = $parentTabid;
$tab->module = $this->name;
$tab->add();
}
要作为子菜单或订单放置,请搜索 $parentTabid
:
$sql = "SELECT `id_tab` FROM `"._DB_PREFIX_."tab` WHERE `class_name` LIKE 'AdminParentOrders'";
$parentTabid = Db::getInstance()->getValue($sql);