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
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
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.
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.
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.
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 at the end of line 3 and before add:
4. Edit the Footer template file, /catalog/view/theme/YOUR_TEMPLATE/template/common/footer.tpl
Within the footer DIV add the following code:
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:. 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
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 } ?>
Directly below
Code: Select all
protected function index() {
Code: Select all
$this->language->load('common/footer');
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;
Within the footer DIV add the following code:
Code: Select all
<div>
<?php foreach ($modules as $module) { ?>
<?php echo ${$module['code']}; ?>
<?php } ?>
</div>
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>
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
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!
Download this ... should make life very easy.
http://www.opencart.com/index.php?route ... ion_id=306
http://www.opencart.com/index.php?route ... ion_id=306
The thread belonging to this link seems to have dissappeared >:(gondalia wrote:Download this ... should make life very easy.
http://www.opencart.com/index.php?route ... ion_id=306
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
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!!!
<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!!!
And more profesional way for opencart_v1.4.7, paste this into information.php after index() { :
And this at footer.tpl after <div class="div2"><?php echo $text_powered_by; ?></div> :
Then change id=information at stylesheet.css and disable information panel.
Regards again!!
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';
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>
Regards again!!
Who is online
Users browsing this forum: No registered users and 3 guests