已创建了可以在将标签安装到prestashop v1.6管理面板时创建标签的模块:创建标签并安装代码如下。请帮助解决。
class Greeting extends Module {
protected $tabs = [
[
'name' => 'Personalised Greetings',
'className' => 'AdminMkonGreetinList',
'active' => 1,
'childs' => [
[
'active' => 0,
'name' => 'List Greetings',
'className' => 'AdminMkonGreetinList',
],
],
];
//Adding Tab on Admin Section
public function addTab($tabs, $id_parent = 0) {
foreach ($tabs as $tab) {
$tabModel = new Tab();
$tabModel->module = $this->name;
$tabModel->active = $tab['active'];
$tabModel->class_name = $tab['className'];
$tabModel->id_parent = $id_parent;
//tab text in each language
foreach (Language::getLanguages(true) as $lang) {
$tabModel->name[$lang['id_lang']] = $tab['name'];
}
$tabModel->add();
//submenus of the tab
if (isset($tab['childs']) && is_array($tab['childs'])) {
$this->addTab($tab['childs'],
Tab::getIdFromClassName($tab['className']));
}
}
return true;
}
public function __construct() {
- - - - - -
}
public function install() {
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
//add Tabs
$this->addTab($this->tabs);
if (!parent::install() || !$this->registerHook('leftColumn') ||
!$this->registerHook('header')) {
return false;
}
$this->frontMenu();
return true;
}
}
点击Tab时
信息中心个性化问候标签: 单击选项卡时出现错误屏幕:
答案 0 :(得分:1)
此错误通常是由于文件(名称)和类(名称)区分大小写而引起的。还需要“ controller”后缀
AdminMkonGreetinListController.php:
<img width="100%" src="assets/fontawesome-free-5.0.1/advanced-options/raw-svg/spinner.svg">