Post by AD. » Sun Jun 19, 2011 4:59 pm

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
Last edited by i2Paq on Sun Jun 19, 2011 8:04 pm, edited 1 time in total.
Reason: Use [version] TAG in subject!

AD.
Newbie

Posts

Joined
Sun Jun 19, 2011 4:56 pm

Post by SXGuy » Sun Jun 19, 2011 7:39 pm

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

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>

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by AD. » Sun Jun 19, 2011 7:52 pm

Doesn't work for me I get

Code: Select all

Parse error: syntax error, unexpected $end in /public_html/shop/catalog/view/theme/default/template/common/header.tpl on line 140
EDIT: Got rid of the error, but the information pages do not show on the header.

AD.
Newbie

Posts

Joined
Sun Jun 19, 2011 4:56 pm

Post by SXGuy » Mon Jun 20, 2011 6:45 pm

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.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by AD. » Tue Jun 21, 2011 3:46 am

Only five categories, no taking up much space, And the solution I wanted would to only show one or two information pages.

AD.
Newbie

Posts

Joined
Sun Jun 19, 2011 4:56 pm

Post by SXGuy » Tue Jun 21, 2011 6:17 am

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

Code: Select all

protected function index() {
add underneath

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');

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by thbr02 » Sun Jun 26, 2011 1:15 am

Go to "Categories" and edit the category you would like to see in the product bar. Choose the "Data" tab and mark the checkbox called "Top".

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden

Post by SXGuy » Sun Jun 26, 2011 3:35 pm

thbr02 wrote:Go to "Categories" and edit the category you would like to see in the product bar. Choose the "Data" tab and mark the checkbox called "Top".
INFORMATION PAGES. not categories.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by AD. » Sun Jun 26, 2011 5:39 pm

Right,
So If I just create an information page then add a link to it on the top bar it will work. But can I remove that information page from the footer.

AD.
Newbie

Posts

Joined
Sun Jun 19, 2011 4:56 pm

Post by SXGuy » Mon Jun 27, 2011 12:51 am

no. information pages in the footer are pulled as a group, you cant single one out to hide it without some extra modding,

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by debbiekipt » Sun Aug 28, 2011 3:56 pm

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>
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!)

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

Active Member

Posts

Joined
Sun Nov 21, 2010 8:10 pm

Post by pitkin2020 » Tue Nov 01, 2011 3:37 am

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??

New member

Posts

Joined
Thu Oct 06, 2011 5:20 am
Who is online

Users browsing this forum: No registered users and 28 guests