T
T
tempick2018-06-30 14:36:39
opencart
tempick, 2018-06-30 14:36:39

How to add link in opencart 3 admin menu?

I can’t add a link to the admin menu in oc 3, I didn’t find information on this version on the Internet (maybe I didn’t search well). You need to add a link to the module in the admin panel in the left menu. How I do it: I add the following
to admin/controller/common/column_left.php:

$data['feat'] = $this->url->link('module/excel1', '&module_id=60&token=' . $this->session->data['token'], true);

and in /admin/view/template/common/column_left.twig is:
<li><a href="{{ feat }}"><i class="fa fa-dashboard fa-fw"></i> <span>пункт</span></a></li>

As a result, the item itself appears, but the link to the module is not formed. When you go, it throws you out of the admin panel, asks you to log in again

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
web-mechanic, 2018-07-10
@amfetamine

I think the modules folder is extension/module/...

S
Sergey Miller, 2021-03-27
@blackseabreathe

It's easier to
admin/controller/common/column_left.php
For example, add a link to the catalog after the link to the "products" page
Here we are looking for

if ($this->user->hasPermission('access', 'catalog/product')) {
        $catalog[] = array(
          'name'	   => $this->language->get('text_product'),
          'href'     => $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token'], true),
          'children' => array()		
        );
      }

And right after we add
if ($this->user->hasPermission('access', 'extension/module/featured')) {
        $catalog[] = array(
          'name'	   => 'Название нашей ссылки, например Акционные товары',
          'href'     => $this->url->link('extension/module/featured', 'user_token=' . $this->session->data['user_token'].'&module_id=38', true),
          'children' => array()
        );
      }

The main thing is to specify where we will check the rights, then where the link leads, do not forget about &module_id=38 , where 38 is the id of the module we need.
Everything

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question