Post by murray » Tue Apr 20, 2010 11:10 pm

Hi,

I want to add the sitemap to the footer.tpl so the footer shows all the categories and information pages displayed as lists.

I have tried copying the script from the sitemap.tpl to the footer.tpl but when viewing in a browser I am getting 'undefined variable' errors.

My scripting knowledge is a bit poor but I was wondering if anybody would be able to give me a few pointers on how to get this to work.

I could just create static code adding each page link in maunually but would like the sitemap to work dynamically.

Thanks

New member

Posts

Joined
Wed Sep 30, 2009 8:24 pm

Post by channelcommerce » Wed Apr 21, 2010 8:21 pm

I'd also be interested in this, i'm sure it's the same issue I have trying to move the cart into the Header.

I think both items are quite important to create modern eCommerce sites with a Web 2.0 feel.

I thought the issue was trying to load the items in the header too early but as the footer has similar issues i'm not so sure.

Opencart Themes and eCommerce Solutions


New member

Posts

Joined
Tue Apr 13, 2010 4:46 am

Post by channelcommerce » Thu Apr 22, 2010 1:50 am

OK, I managed to get the Information module to load in the footer, which is what I required for my site. Here's how I did it:

1. Start by making a copy of the module in your template so you aren't changing the default.

2. Create an option in Admin to allow the module position to be set to 'Footer'

Open file /admin/view/template/module/information.tpl and add the following code directly after the left/right position code, after line 27, before the </select> tag.

Code: Select all

 <?php if ($information_position == 'footer') { ?>
              <option value="footer" selected="selected"><?php echo 'Footer'; ?></option>
              <?php } else { ?>
              <option value="footer"><?php echo 'Footer'; ?></option>
              <?php } ?>
3. Add code to the controller that processes the footer data so it will find the module. File, /catalog/controller/common/footer.php

Directly below

Code: Select all

protected function index() {
at the end of line 3 and before

Code: Select all

$this->language->load('common/footer');
add:

Code: Select all

		$module_data = array();
		
		$this->load->model('checkout/extension');
		
		$results = $this->model_checkout_extension->getExtensions('module');

		foreach ($results as $result) {
			if ($this->config->get($result['key'] . '_status') && ($this->config->get($result['key'] . '_position') == 'footer')) {
				$module_data[] = array(
					'code'       => $result['key'],
					'sort_order' => $this->config->get($result['key'] . '_sort_order')
				);
				
				$this->children[] = 'module/' . $result['key'];		
			}
		}

		$sort_order = array(); 
	  
		foreach ($module_data as $key => $value) {
      		$sort_order[$key] = $value['sort_order'];
    	}

    	array_multisort($sort_order, SORT_ASC, $module_data);			
		
		$this->data['modules'] = $module_data;
4. Edit the Footer template file, /catalog/view/theme/YOUR_TEMPLATE/template/common/footer.tpl

Within the footer DIV add the following code:

Code: Select all

<div>
  <?php foreach ($modules as $module) { ?>
  <?php echo ${$module['code']}; ?>
  <?php } ?>
</div>
You should assign an id to the div and style it in the stylesheet as required.

5. Strip the DIV tags from the module file.

------------------------------------------------------------

To make the sitemap file work instead of the information module, make a copy of the file under your template as I did the information module in step 1. /catalog/view/theme/YOUR_TEMPLATE/template/information/sitemap.tpl

Ignore step 2.

Step 3 you may not require the code I added, I expect you will also need to add a large section from /catalog/controller/common/header.php where all the variables are defined from around line 80 to around 105.

Step 4 use code:

Code: Select all

<div><?php include '/catalog/view/theme/YOUR_TEMPLATE/template/information/sitemap.tpl'; ?></div>
. Assign id and style as required.

Step 5 remains the same, take all the divs from the tpl file, also the php echos, just leaving the table.

I hope that helps!

Matt

Opencart Themes and eCommerce Solutions


New member

Posts

Joined
Tue Apr 13, 2010 4:46 am

Post by murray » Thu Apr 22, 2010 4:34 pm

Cheers Matt I will give this go!!

New member

Posts

Joined
Wed Sep 30, 2009 8:24 pm

Post by channelcommerce » Thu Apr 22, 2010 10:33 pm

What I should also add is once you start modifying the controller files and removing divs from the modules that are designed for the side columns it will not work with other templates. trying to switch templates will completely screw up the layout!

Opencart Themes and eCommerce Solutions


New member

Posts

Joined
Tue Apr 13, 2010 4:46 am

Post by gondalia » Fri Apr 23, 2010 3:18 am

Download this ... should make life very easy.

http://www.opencart.com/index.php?route ... ion_id=306

New member

Posts

Joined
Sat Apr 10, 2010 12:45 am

Post by cmebd » Tue Apr 27, 2010 4:17 am

gondalia wrote:Download this ... should make life very easy.

http://www.opencart.com/index.php?route ... ion_id=306
The thread belonging to this link seems to have dissappeared >:(

A stupid question is the one you -don't- ask.........(Anon)

)C1.5.0.1 (IN devel)
OC V1.4.9.5
OC V1.4.9.2
OC V1.4.7
OC V1.3.4


User avatar
Active Member

Posts

Joined
Fri Nov 13, 2009 11:17 am
Location - Tasmania, Australia

Post by buggi » Wed May 05, 2010 9:04 pm

create a new div on footer.tpl and include the link of site map like this:

<div class="divinf"><a href="http://yoursite.com/index.php?route=inf ... p</a></div>

Then on stylesheet.css write the "divinf" css properties.

Thats the simplest way...I think

Regards!!!

Newbie

Posts

Joined
Wed May 05, 2010 8:58 pm

Post by buggi » Wed May 05, 2010 9:52 pm

And more profesional way for opencart_v1.4.7, paste this into information.php after index() { :

Code: Select all

$this->language->load('module/information');
		
    	$this->data['heading_title'] = $this->language->get('heading_title');
    	
		$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->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=information/information&information_id=' . $result['information_id'])
      		);
    	}

		$this->data['contact'] = HTTP_SERVER . 'index.php?route=information/contact';
    	$this->data['sitemap'] = HTTP_SERVER . 'index.php?route=information/sitemap';
And this at footer.tpl after <div class="div2"><?php echo $text_powered_by; ?></div> :

Code: Select all

<table width="550" border="0" align="center">
  <tr>
  <td>
   <div id="information" align="center">
    
      <?php foreach ($informations as $information) { ?>
      <a href="<?php echo str_replace('&', '&', $information['href']); ?>"><?php echo $information['title']; ?></a>
      <?php } ?>
      <a href="<?php echo str_replace('&', '&', $contact); ?>"><?php echo $text_contact; ?></a>
      <a href="<?php echo str_replace('&', '&', $sitemap); ?>"><?php echo $text_sitemap; ?></a>
    
  </div></td>
  </tr>
</table>
Then change id=information at stylesheet.css and disable information panel.

Regards again!!

Newbie

Posts

Joined
Wed May 05, 2010 8:58 pm

Post by borrie » Mon Apr 04, 2011 6:31 pm

this ain't working for the footer sitemap.

Information module does work.

Please upload files for footer sitemap

New member

Posts

Joined
Mon Jan 10, 2011 7:59 pm
Who is online

Users browsing this forum: No registered users and 3 guests