Page 1 of 1

Adding links/static pages on top menu bar

Posted: Thu Jan 19, 2012 8:21 am
by Saile
I have v1.5.1.3 of OpenCart and want to be able t o put links that direct to a another age on the site. I was it to be located on the top menu bar which is the catalog bar.

Alternatively if i can possibly duplicate that bar, 1 bar would be for products etc (default), the other bar below would contain the links to other pages.

Thanks

Re: Adding links/static pages on top menu bar

Posted: Thu Jan 19, 2012 3:42 pm
by philbydevil
Look in your header.tpl file and find the menu:

Code: Select all

<div id="menu">
  <ul>
    <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
      <?php if ($category['children']) { ?>
      <div>
        <?php for ($i = 0; $i < count($category['children']);) { ?>
        <ul>
          <?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
          <?php for (; $i < $j; $i++) { ?>
          <?php if (isset($category['children'][$i])) { ?>
          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
          <?php } ?>
          <?php } ?>
        </ul>
        <?php } ?>
      </div>
      <?php } ?>
    </li>
    <?php } ?>
  </ul>
</div>
Copy it and change to something like this:

Code: Select all

<div id="menu">
<ul>
<li>Link1</li>
<li>Link2</li>
<li>Link3</li>
</ul>
</div>
Put this below your original menu and you should have two. Be sure to back up the file first just in case there are any problems.

Re: Adding links/static pages on top menu bar

Posted: Thu Jan 19, 2012 3:55 pm
by Saile
thanks for reply.

is there anyway i can duplicate it?

Re: Adding links/static pages on top menu bar

Posted: Thu Jan 19, 2012 4:08 pm
by philbydevil
Put the second bit of code under the first bit of code.

Re: Adding links/static pages on top menu bar

Posted: Thu Jan 19, 2012 5:06 pm
by Saile
i tryed that but its not an exact duplicate. The text isnt spaced, wrong colors etc. Its not a complete duplicate.

Re: Adding links/static pages on top menu bar

Posted: Thu Jan 19, 2012 5:48 pm
by webvet
The css styles will be identical if you follow the same structure and use:

Code: Select all

<div id="menu">
<ul>
<li><a href="your link address">LINK 1</a></li>
<li><a href="next link address">LINK 2</a></li>
<li><a href="and the next one">LINK 3</a></li>
</ul>
</div>
The text will be coloured, styled and spaced exactly as the css for the other menu listed links.

Re: Adding links/static pages on top menu bar

Posted: Fri Jan 20, 2012 5:10 am
by Saile
oh that did it! Great! thanks

When you click top bar though, it expands over the second bar.

Is it possible maybe to put that bar on the left or right?

Re: Adding links/static pages on top menu bar

Posted: Fri Apr 27, 2012 7:03 pm
by ste_barrett
Thanks for this. I did it at shop.mangotreeuganda.org but it is only showing on the homepage. Other pages revert to previous layout. Any idea where I'm going wrong? I'm sure its obvious to many people here but not to a newbie like me.
Thanks
S

Re: Adding links/static pages on top menu bar

Posted: Fri Apr 27, 2012 10:59 pm
by webvet
@ste_barrett

If you are using a standard Opencart set-up and place the code in the catalog/view/theme/*/template/common/header.tpl file it will be called on ALL pages.

If you have put it in this file and it isn't displaying then your theme may be doing odd things... If it is then I suggest you approach the theme designer!