opencart3.0后台怎么添加功能菜单

一:设置语言包变量

找到对应 1、admin\language 下的语言包文件夹,以 zh-cn 为例。

admin\language\zh-cn\common\column_left.php

追加如下:

//xuduowei 微信:weilanweb
$_['text_news'] = '新闻';  //新添加的菜单名称
$_['text_news_category'] = '新闻分类';
$_['text_news_infos'] = '新闻文章';

二、设置调用控制器

admin\controller\common\column_left.php

在需要插入目录的地方插入如下代码:

//xdw b 2019/1/10
$news = array();
//新闻分类
if ($this->user->hasPermission('access', 'catalog/category')) {
	$news[] = array(
		'name'	   => $this->language->get('text_news_category'),
		'href'     => $this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token']),
		'children' => array()
	);
}


//新闻文章
if ($this->user->hasPermission('access', 'catalog/information')) {
	$news[] = array(
		'name'	   => $this->language->get('text_news_infos'),
		'href'     => $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token']),
		'children' => array()
	);
}

if ($news) {
	$data['menus'][] = array(
		'id'       => 'menu-blog',
		'icon'	   => 'fa fa-book fw',
		'name'	   => $this->language->get('text_news'),
		'href'     => '',
		'children' => $news
	);
}
//xdw end 2019/1/10

最终效果:

实际具体的新闻分类,新闻文章功能略。


关注公众号,了解更多it技术(it问答网

发表评论

电子邮件地址不会被公开。