Prestashop - 在管理员菜单下为我的模块添加自定义菜单项

时间:2017-03-06 07:47:04

标签: php prestashop prestashop-1.6

我的问题是:

如何通过代码在pestashop后台的订单菜单(例如)下为我的prestashop模块添加自定义菜单项?

enter image description here

1 个答案:

答案 0 :(得分:2)

您可以在模块安装功能上添加菜单项。

$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);