Hello,
I want to add some Information pages in the top bar where product categories are, I have seen threads showing how to put them in the footer and top bar where Home is.
Could anyone help with this?
Thanks,
Adam
OpenCart 1.5.0
Clean Install
I want to add some Information pages in the top bar where product categories are, I have seen threads showing how to put them in the footer and top bar where Home is.
Could anyone help with this?
Thanks,
Adam
OpenCart 1.5.0
Clean Install
Last edited by i2Paq on Sun Jun 19, 2011 8:04 pm, edited 1 time in total.
Reason: Use [version] TAG in subject!
Reason: Use [version] TAG in subject!
here you can have my mod, it should work fine for you.
edit catalog/view/theme/yourtheme/template/common/header.tpl
find <div id="menu">
remove everything including that div and the closing div that matches it.
and paste this
edit catalog/view/theme/yourtheme/template/common/header.tpl
find <div id="menu">
remove everything including that div and the closing div that matches it.
and paste this
Code: Select all
<div id="menu">
<ul>
<li><a href="<?php echo $home; ?>"><?php echo $text_home; ?></a></li>
<?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 } ?>
<?php foreach ($informations as $information) { ?>
<li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a>
<?php } ?>
</li>
<li><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li>
<li><a href="<?php echo $sitemap; ?>"><?php echo $text_sitemap; ?></a></li>
</ul>
</div>
Doesn't work for me I get
EDIT: Got rid of the error, but the information pages do not show on the header.
Code: Select all
Parse error: syntax error, unexpected $end in /public_html/shop/catalog/view/theme/default/template/common/header.tpl on line 140
Perhaps i edited the controller file for the header, i cant remember. Im not at my pc with opencart at the moment, so i cant check, but watch this space, and ill update you later with the changes you should make to the header controller file.
EDIT: just checked, no controller file modification was needed.
I need you to explain in more detail why it isnt showing.
Perhaps you have too many categories taking up the menu bar, and that is why the information pages are not showing.
If this is the case, you need to either edit the stylesheet menu div to fit them all in, or remove the category information from the menu altogether.
EDIT: just checked, no controller file modification was needed.
I need you to explain in more detail why it isnt showing.
Perhaps you have too many categories taking up the menu bar, and that is why the information pages are not showing.
If this is the case, you need to either edit the stylesheet menu div to fit them all in, or remove the category information from the menu altogether.
If you only want to show 1 or two information pages then just add those as links instead
<li><a href="linktoyourpage">page name</a></li>
EDIT: btw the previous code does work, i tottaly fogot i did edit the header controller file.
catalog/controller/common/header.php
find
add underneath
<li><a href="linktoyourpage">page name</a></li>
EDIT: btw the previous code does work, i tottaly fogot i did edit the header controller file.
catalog/controller/common/header.php
find
Code: Select all
protected function index() {
Code: Select all
$this->language->load('module/information');
$this->data['text_contact'] = $this->language->get('text_contact');
$this->data['text_sitemap'] = $this->language->get('text_sitemap');
$this->load->model('catalog/information');
$this->data['informations'] = array();
foreach ($this->model_catalog_information->getInformations() as $result) {
$this->data['informations'][] = array(
'title' => $result['title'],
'href' => $this->url->link('information/information', 'information_id=' . $result['information_id'])
);
}
$this->data['contact'] = $this->url->link('information/contact');
$this->data['sitemap'] = $this->url->link('information/sitemap');
Can you tell me which file and where I need to add the <li> code to, to get it to work? (i'm not a coder!)Re: [1.5.0]Information Pages in Product Bar
Postby SXGuy » Mon Jun 20, 2011 10:17 pm
If you only want to show 1 or two information pages then just add those as links instead
<li><a href="linktoyourpage">page name</a></li>
I want to add a link to the header bar which is not a category, so far can only get it to appear in the first position (left) on the bar, would like it as the last item (right) - must have put code in the wrong place!
Many thanks in advance for any help :-)
Using 1.5.1.1 - clean install
Hey all, any further info on this??
I have got this working and it looks good, problem is the top bar will only show if I have atleast one catergory selected to be displayed in the top bar. Is there anyway to have the top bar displaying with the information page links but with no catergory selected??
I have got this working and it looks good, problem is the top bar will only show if I have atleast one catergory selected to be displayed in the top bar. Is there anyway to have the top bar displaying with the information page links but with no catergory selected??
Who is online
Users browsing this forum: No registered users and 28 guests