OpenCart Admin Menu URL

I am new to OpenCart and I am trying to create a module for it.

I need a link in the admin menu for the module I am creating, so I edited this file:

/admin/view/template/common/header.tpl 

The code I added:

 <li><a class="top">Import / Export</a> <ul> <li><a href="" target="_blank">Link 1</a></li> <li><a href="" target="_blank">Link 2</a></li> <li><a href="" target="_blank">Link 3</a></li> </ul> </li> 

My question is agilely simple:

In regular links, the url for <a href=""> set as follows:

 <a href="<?php echo $report_customer_online; ?>"> 

How can I make a url for the correct module with an OpenCart marker?

The path to the module module/order_export .

If you need more information, feel free to ask ...

+4
source share
4 answers

See my answer here: fooobar.com/questions/1480966 / ... - I answered a very similar question, anyway, the answer is the same as for your question.

But it’s more accurate to guide you:

language file /admin/language/<YOUR_LANGUAGE>/common/header.php add, for example:

 $_['text_my_module'] = 'My Module Title'; 

controller file /admin/controller/common/header.php add for example:

 $this->data['text_my_module'] = $this->language->get('text_my_module'); 

and

 $this->data['my_module'] = $this->url->link('module/order_export', 'token=' . $this->session->data['token'], 'SSL'); 

and finally, add the template file /admin/view/template/common/header.tpl :

 <a href="<?php echo $my_module; ?>" class="top"><?php echo $text_my_module; ?></a> 

where applicable ...

Is this the right answer for you?

+10
source

It is easy to create. but you need to edit the following files and add some links, like what they said above. But he will disappear. when you go with opencart update. So, here is an example of creating VQMod Link and its extension. Try it /

http://kvcodes.com/2014/06/how-to-create-admin-menu-link-for-custom-admin-page-opencart/

+1
source

In Opencart 2:

language file /admin/language/<YOUR_LANGUAGE>/common/menu.php add for example:

 $_['text_my_module'] = 'My Module Title'; 

controller file /admin/controller/common/menu.php add for example:

 $data['text_my_module'] = $this->language->get('text_my_module'); 

and

 $data['my_module'] = $this->url->link('catalog/my_module', 'token=' . $this->session->data['token'], 'SSL'); 

and finally add the template file /admin/view/template/common/menu.tpl :

 <li><a href="<?php echo $my_module; ?>">text_my_module</a></li> 

where applicable ...

+1
source

Thanks Anuj!

I did this with OpenCart 2.3, and the files for editing to the left of the column instead of the menu.

And if you want your link to look like other main categories, here is the code with the class:

 <li><a href="<?php echo $my_module; ?>"><i class="fa fa-clock-o fw"></i><span><?php echo $text_my_module ?></span></a></li> 

Note that I also included the icon from the Awesome font in the <i> class

0
source

Source: https://habr.com/ru/post/1480965/


All Articles