Page 1 of 2

[How-to] Add information info links in footer

Posted: Sun Aug 08, 2010 8:53 am
by Maansy
if you like to add the information links to footer (live example), this is what you have to do:
Files we need to edit: 3
information_in_footer.jpg

information_in_footer.jpg (20.55 KiB) Viewed 30876 times

open: catalog\controller\common\footer
after:

Code: Select all

protected function index() {
        $this->language->load('common/footer');
 
add:

Code: Select all

// information in footer
        $this->load->model('catalog/information');
        $this->load->model('tool/seo_url');
        $this->data['text_contact'] = $this->language->get('text_contact');
        $this->data['text_sitemap'] = $this->language->get('text_sitemap');
        $this->data['text_information'] = $this->language->get('text_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';    
        //end
 

open: catalog\language\english\common\footer

befor ?>

add:

Code: Select all

$_['text_contact']  = 'Contact Us';
$_['text_sitemap']  = 'Sitemap';
$_['text_information']  = 'Information';
 

open: catalog\view\theme\default\template\common\footer.tpl (the name of your template)

add this to the desired location to display (this is how i placed it, be creative):

Code: Select all

<div>
    <ul>
            <?php foreach ($informations as $information) { ?>
      <li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li>
      <?php } ?>
      <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>

Re: [How-to] Add information info links in footer

Posted: Mon Aug 09, 2010 4:00 am
by Moggin
Thank you for this Maansy! And thanks also for the tutorial on showing the cart total in the header. Much appreciated.

Re: [How-to] Add information info links in footer

Posted: Mon Aug 09, 2010 4:11 am
by Maansy
You are welcome sir :)

Re: [How-to] Add information info links in footer

Posted: Tue Aug 17, 2010 12:49 am
by mfrerebeau
Hello,

Thanks a lot Maansy !
That was exactly I search...

I'm beginner in OpenCart... And I begin to understand somethings :)
I think we could make better with this line in catalog\controller\common\footer just before your change :

Code: Select all

		$this->language->load('module/information');
Then no need to modify catalog\language\english\common\footer and translate of the same words have to be made just one time.
It seems to work.

But as I'm beginner, perhaps it's a mistake ???
Could you validate it or say me why it isn't ?

Re: [How-to] Add information info links in footer

Posted: Tue Aug 17, 2010 6:41 am
by Maansy
I think that's possible and I thought about it. This reason why I didn't do it that way simply because I didn't want to load another lang file due to speed of the page. And since footer.php in lang folder is loaded so why not utilize it.

Re: [How-to] Add information info links in footer

Posted: Tue Aug 17, 2010 4:00 pm
by mfrerebeau
Thanks to take time explaining it.
That's interesting.
I'll think if I see some slowdowns...

It isn't very easy to see all of theses details when we begin... And it's very instructive. :)

Re: [How-to] Add information info links in footer

Posted: Thu Aug 19, 2010 3:04 am
by carlchen414
hello! Maansy. everyone! im new for opencart. I have got one problem with adding information into links in footer. I followed the steps shown above. but it shows me
Notice: Undefined variable: footer in C:\phpnow\htdocs\open_cart\catalog\view\theme\default\template\common\home.tpl on line 31...
what's problem with home.tpl??? i didnt change anything with home.tpl. could anyone help me. thanks in advanced!

Re: [How-to] Add information info links in footer

Posted: Thu Aug 19, 2010 3:27 am
by carlchen414
thanks...sorry! i made a mistake...now mine is working..thanks Maansy, everyone!

Re: [How-to] Add information info links in footer

Posted: Sun Sep 05, 2010 9:24 pm
by davykeenan
Good tutorial, great work but if you want that little extra you can get this extension and it's all done for you.

http://www.opencart.com/index.php?route ... 331&page=3

2CPTG,

Davy K

Re: [How-to] Add information info links in footer

Posted: Mon Sep 06, 2010 12:00 am
by Maansy
whats your extra so i can included for free ;)

Re: [How-to] Add information info links in footer

Posted: Mon Sep 06, 2010 1:41 am
by davykeenan
Well you know there is one way to find out, just purchase the mod, all code is free from license so you can post it up. I wish I could give away all my mods but got to make a living as time is money for me and of course a lot of opencart users wouldn't want to edit files themselves and don't understand php. O0

Re: [How-to] Add information info links in footer

Posted: Mon Sep 06, 2010 4:54 am
by davykeenan
Oh and they are all really cheap unlike a lot of other developers ;)

Re: [How-to] Add information info links in footer

Posted: Thu Sep 09, 2010 6:12 pm
by fireatwire
Very good mod. What do I have to do to put one single information page link in the footer?

Re: [How-to] Add information info links in footer

Posted: Thu Sep 09, 2010 7:20 pm
by davykeenan
fireatwire wrote:Very good mod. What do I have to do to put one single information page link in the footer?
Hi, if your taking about my footer mod, you can edit the language file

catalog\language\english\common\footer.php

you could do something like this (can remove or shorten opencart link to give more space, see admins they would like a donation to opencart to remove opencart link, but have said its ok to do so), then add info or link to the company bit.

$_['foot_created_by'] = ' ';
$_['foot_company'] = '<a href="myinfopage.php" title="whatever" >This is my new info link... blah...blah</a><br /><br />Thanks for viewing our website please contact us if you have an enquiry.';

COULD REMOVE THE THANKS STUFF TOO..

I know its a bit of a tech response but this mod was designed to be simple and not to heavy in code, and also work with custom themes.

If your still not sure or this isn't what you were looking for, let me know and I can help further, maybe change the mod to how you need it...

Davy K

Re: [How-to] Add information info links in footer

Posted: Thu Sep 09, 2010 7:26 pm
by davykeenan
fireatwire wrote:Very good mod. What do I have to do to put one single information page link in the footer?
just read the question another way as well.

If your looking for an information page to be displayed and there is not enough room, just move the sort order in the admin so the info page you want is at the top. sort order 1 or 2, then make sure the correct number of links is set in the language file.

If you want custom additions to this mod add them to the comments in the extensions page or email me dave@dknet.co.uk

Re: [How-to] Add information info links in footer

Posted: Sun Sep 26, 2010 4:00 am
by TAC
Hi, the code from Maansy is the first modification I made to OpenCart once I downloaded it today. It worked and put my information pages in the footer but nothing else. In the screen shot you have 3 lists with titles but I don't. Have I missed something? I would really like to have all the categories listed there too - is this possible?

Thanks in advance

Re: [How-to] Add information info links in footer

Posted: Sun Sep 26, 2010 5:09 pm
by davykeenan
If you buy the mod/ext mentioned, the categories are included.

http://www.opencart.com/index.php?route ... 331&page=3

Davy K

Re: [How-to] Add information info links in footer

Posted: Mon Oct 04, 2010 1:27 am
by jty
Maansy wrote:whats your extra so i can included for free ;)
Don't temp me Maansy or you will be my slave for months :choke:
There is room for commercial mods. It's alot cheaper to pay money than to pay with all that time learning ........ except that I don't want a footer mod.

But I came to say thank-you Maansy. Your contribution, and free too, has solved a problem I have been too afraid to tackle for 2 months ie how to replace the layout.tpl
I've used your idea to mod the left column. Then I might use the idea to mod the right column. I suppose I should also use it to mod the header just because I can and you taught me how. Thank-you

Re: [How-to] Add information info links in footer

Posted: Mon Oct 04, 2010 4:29 am
by Maansy
jty wrote:
Maansy wrote:whats your extra so i can included for free ;)
Don't temp me Maansy or you will be my slave for months :choke:
There is room for commercial mods. It's alot cheaper to pay money than to pay with all that time learning ........ except that I don't want a footer mod.

But I came to say thank-you Maansy. Your contribution, and free too, has solved a problem I have been too afraid to tackle for 2 months ie how to replace the layout.tpl
I've used your idea to mod the left column. Then I might use the idea to mod the right column. I suppose I should also use it to mod the header just because I can and you taught me how. Thank-you
i hope you are just kidding here.

sure, you're welcome

Re: [How-to] Add information info links in footer

Posted: Mon Oct 04, 2010 5:08 am
by Maansy
TAC wrote:Hi, the code from Maansy is the first modification I made to OpenCart once I downloaded it today. It worked and put my information pages in the footer but nothing else. In the screen shot you have 3 lists with titles but I don't. Have I missed something? I would really like to have all the categories listed there too - is this possible?

Thanks in advance
nope you didnt miss anything

this thread is [How-to] Add information info links in footer

for the others (account and bestsellers) i will post the How-to soon in different threads