How to Create Admin Menu Link for Custom Admin Page opencart
X

Congrats, You are Subscribed to Receive Updates.

How to Create Admin Menu Link for Custom Admin Page opencart


how to create admin menu link for custom admin page opencart. The question comes when we create a custom page inside your opencart. Once you created a custom page you need to provide link from the admin menu bar. From that link will help your users to understand that the link will help them to reach your page.

screenshot-of-admin-menu-link

Now , you have two options to implement the custom menu link creation

  • Edit the core files of opencart
  • Create links by using VqMod.

Here you have two choices. You can simply edit the core and add your links into it.Alternatively use VQmod to create better linking. Lets start with core files editing. 1. Edit the core files of opencart Open the following files based on the directory structure.

Admin/controller/common/header.php
Admin/language/english/common/header.php
Admin/view/template/common/header.tpl

Lets start with controller file. Open admin/controller/common/header.php and find the following line

$this->data['openbay_link_amazonus_links'] = $this->url->link('openbay/amazonus/itemLinks', 'token=' . $this->session->data['token'], 'SSL');

And add below the following line of code.

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

And one more thing in the same file. Find the following line of code

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

and add below the following line of code.

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

That’s it for controller file. Now, open your language file “ admin/language/english/common/header.php “. And add the following line of code into it.

$_['kv_custom_menu_item'] = 'KV Custom Page';

And , Finally open your template file ” admin/view/template/common/header.tpl “. Here you need to place the file where you want to add the menu item. I mean the position will be based on the order of the line.  Here i add the link next to the dashboard . So it will be easy to view.

<li> <a href="<?php echo $kvc_custom_page; ?>" class="top"><?php echo $kv_custom_menu_item; ?></a></li>

That’s it, now your custom page is linked with your admin menu. But here is a problem. When you think to update your store . The changes will be vanished. Because you worked with Core files. So here is a alternative method.

2.Create links by using VqMod.

This will be useful and always helps you to get the link by using  VQMod.

<modification>
	<id>Custom Page Admin Link. </id>
	<version>0.1</version>
	<vqmver>2.0</vqmver>
	<author>Kvvaradha</author>
	<file name="admin/controller/common/header.php">
		<operation>
			<search position="after"><![CDATA[
				$this->data['openbay_link_amazonus_links'] = $this->url->link('openbay/amazonus/itemLinks', 'token=' . $this->session->data['token'], 'SSL');
			]]></search>
			<add><![CDATA[
				$this->data['kvc_custom_page'] = $this->url->link('module/kvc', 'token=' . $this->session->data['token'], 'SSL');
			]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
				$this->data['text_recurring_profile'] = $this->language->get('text_recurring_profile');
			]]></search>
			<add><![CDATA[
				$this->data['kv_custom_menu_item'] = $this->language->get('kv_custom_menu_item');
			]]></add>
		</operation>		
	</file>
	<file name="admin/language/english/common/header.php">
		<operation>
			<search position="after"><![CDATA[
				$_['text_recurring_profile']           = 'Recurring Profiles';
			]]></search>
			<add><![CDATA[
				$_['kv_custom_menu_item'] = 'KV Custom Page';
			]]></add>
		</operation>
	</file>
	<file name="admin/view/template/common/header.tpl">
		<operation>
			<search position="after"><![CDATA[
				 <li id="dashboard"><a href="<?php echo $home; ?>" class="top"><?php echo $text_dashboard; ?></a></li>
			]]></search>
			<add><![CDATA[
				<li> <a href="<?php echo $kvc_custom_page; ?>" class="top"><?php echo $kv_custom_menu_item; ?></a></li>
			]]></add>
		</operation>
	</file>
	
</modification>

That’s it, you can download this VQMod file from extension directory of OpenCart.

Download Source

 

 

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, OpenCart Theme Development, PHP, HTML, CSS, jQuery, Bootstrap development and content SEO.

6 comments

  1. commenter

    Thank you great tutorial. First one about creating permission worked perfect. But in this tutorial KV CUSTOM Page didnt worked. Actually there appeared menu item but this error occured.Permission Denied! But i gave a permission in the ceckbox KVC/firs for acces and modified.
    Whats the problem?

  2. commenter

    I replaced this code you wrote $this->data[‘kvc_custom_page’] = $this->url->link(‘module/kvc’, ‘token=’ . $this->session->data[‘token’], ‘SSL’);

    to this one and it worked.

    $this->data[‘kvc_custom_page’] = $this->url->link(‘kvc/first’, ‘token=’ . $this->session->data[‘token’], ‘SSL’);

    is that true or you have another solution to give us?

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar

Subscribe E-mail Updates

Congrats, You are Subscribed to Receive Updates.

Advertisement

Category Posts