Jerielle
Jerielle

Reputation: 7520

How to add a new link in admin navigation menu using OpenCart?

Today I am studying OpenCart for my next project. And I am having a trouble with my code. What I want to do is to simply add another link in admin navigation menu under the Catalog list. But whenever I edit the header.tpl it doesn't show my update. Here's what I did.

I add another link named 'mypage' The file is located at: admin/view/template/common/header.tpl

Here's my update

<div id="menu">
    <ul class="left" style="display: none;">
      <li id="dashboard"><a href="<?php echo $home; ?>" class="top"><?php echo $text_dashboard; ?></a></li>
      <li id="catalog"><a class="top"><?php echo $text_catalog; ?></a>
        <ul>
          <li><a href="<?php echo $category; ?>"><?php echo $text_category; ?></a></li>
          <li><a href="<?php echo $product; ?>"><?php echo $text_product; ?></a></li>
          <li><a href="<?php echo $filter; ?>"><?php echo $text_filter; ?></a></li>
          <li><a href="<?php echo $profile; ?>"><?php echo $text_profile; ?></a></li>
          <li><a class="parent"><?php echo $text_attribute; ?></a>
            <ul>
              <li><a href="<?php echo $attribute; ?>"><?php echo $text_attribute; ?></a></li>
              <li><a href="<?php echo $attribute_group; ?>"><?php echo $text_attribute_group; ?></a></li>
            </ul>
          </li>
          <li><a href="<?php echo $option; ?>"><?php echo $text_option; ?></a></li>
          <li><a href="<?php echo $manufacturer; ?>"><?php echo $text_manufacturer; ?></a></li>
          <li><a href="<?php echo $download; ?>"><?php echo $text_download; ?></a></li>
          <li><a href="<?php echo $review; ?>"><?php echo $text_review; ?></a></li>
          <li><a href="<?php echo $information; ?>"><?php echo $text_information; ?></a></li>

          <li><a href="<?php echo $mypage; ?>"><?php echo $text_mypage; ?></a></li>

        </ul>
      </li>

As you can see I added another link below information.

Now the next step I include the language variable in the controller The file is located at: admin/controller/header.php

I added this line:

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

Now the last step I did is I include the link in my language file The file is located at: admin/language/english/common/header.php

I added this line:

$_['text_mypage']                      = 'My Page';

Now my problem is it doesn't show my link. I don't know where did I get wrong. Please help me I am new in this framework. I also cleared the cache manually but same effect.

Upvotes: 0

Views: 2643

Answers (1)

Rakesh Singh Uniyal
Rakesh Singh Uniyal

Reputation: 15

Jerielle,

I think you are missing a point here in this file.

in admin/controller/header.php

you also need to define

$this->data['mypage'] = $this->url->link('your_link', 'token=' . $this->session->data['token'], 'SSL');

like this.

Check this page carefully you will find this section on this file..

Upvotes: 0

Related Questions