Post by KenjiRobbert » Thu Sep 16, 2010 12:53 am

Hi
I want to place the 'information' module into the header horizontally. I already tried to copy the php code from the file information.tpl into the header.tpl (between the div4). But it seems I will not work:( Can somebody tell me how to do ?
Thanks in advance!

This is the code that's inside the information.tpl

Code: Select all

<div class="box">
  <div class="top"><img src="catalog/view/theme/default/image/information.png" alt="" /><?php echo $heading_title; ?></div>
  <div id="information" class="middle">
    <ul>
      <?php foreach ($informations as $information) { ?>
      <li><a href="<?php echo str_replace('&', '&', $information['href']); ?>"><?php echo $information['title']; ?></a></li>
      <?php } ?>
      <li><a href="<?php echo str_replace('&', '&', $contact); ?>"><?php echo $text_contact; ?></a></li>
      <li><a href="<?php echo str_replace('&', '&', $sitemap); ?>"><?php echo $text_sitemap; ?></a></li>
    </ul>
  </div>
  <div class="bottom">&nbsp;</div>
</div

Newbie

Posts

Joined
Thu Sep 16, 2010 12:43 am

Post by JAY6390 » Thu Sep 16, 2010 1:21 am

Open

Code: Select all

/catalog/controller/common/header.php
Find

Code: Select all

$this->render(); 
on a new line BEFORE it put

Code: Select all

$this->children = array('module/information'); 
Then in your

Code: Select all

catalog/view/theme/your-theme-name/template/common/header.tpl
put

Code: Select all

echo $information; 
This will echo the information module out there. Note you will need to disable the information module in the back end to stop it showing in the columns
if you want to remove the box around it, you will need to remove the divs etc from module/information.tpl in your template folder

NOTE: This is not tested, so it might not work, but should. MAKE BACKUPS BEFORE ATTEMPTING ANY OF THESE EDITS

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Maansy » Thu Sep 16, 2010 5:25 am

this is a cool way Jay :)
i have done it differently but add it to the footer (same concept basicly).
the How-to is in my sig

good luck :)

ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com


User avatar
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by JAY6390 » Thu Sep 16, 2010 5:32 am

Yeah, you've made the links more customised. The method I used is to literally put the module in the header

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by KenjiRobbert » Fri Sep 17, 2010 1:41 am

Thanks for both replies!!It works:)

Newbie

Posts

Joined
Thu Sep 16, 2010 12:43 am

Post by Maffs » Wed Nov 30, 2011 9:16 am

This tip now impossible with 1.5+

I am wanting to do the same thing, does anyone have any suggestions?

Newbie

Posts

Joined
Tue Oct 18, 2011 5:46 pm

Post by fido-x » Wed Nov 30, 2011 12:35 pm

Maffs wrote:This tip now impossible with 1.5+

I am wanting to do the same thing, does anyone have any suggestions?
The code posted above by Jay does work in the current version. You probably have some modification that is causing a conflict. For example, if you have a modification that already adds a children array (possibly through a vQmod) to the header by way of:

Code: Select all

$this->children = array('path/file'); 
then this will cause a conflict if you add another:

Code: Select all

$this->children = array('path/file'); 
ie. one will overwrite the other. Or, more to the point, replace one child module with another.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by Maffs » Thu Dec 01, 2011 3:01 am

Thank you for replying. I stand corrected. I did a search for the

Code: Select all

$this->render();
and it came back with zero results the first time. This time I searched line by line and found it. Now I am not sure why Dreamweaver would do so poorly on a search.

Newbie

Posts

Joined
Tue Oct 18, 2011 5:46 pm

Post by sobiech1 » Fri Jan 13, 2012 10:21 pm

Very helpful! Thanks for the tutorial.
I am having one "problem" with this now.
I need only 2 of 4 information pages in header. Any ideas how to exclude them?
Only id=3 and id=6 pages are needed. Maybe "if id=3 then echo..." somewhere would do the job? :)

I am not familiar with php that much...

PS. What should I add to header so variable $text_contact (link to mail-form from footer) will be available to use?

Newbie

Posts

Joined
Thu Jan 12, 2012 7:46 pm

Post by JohnMaguire2013 » Tue May 22, 2012 2:17 am

Hey guys,

I wrote a quick vqMod script to add the $informations array which can be accessed in footer.tpl to the header.tpl. Simply upload this either through VQMod Manager, FTP, or your method of choice, as add_informations_to_header.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>Add Information module to header template</id>
    <version>1.0.0</version>
    <vqmver>1.0.8</vqmver>
    <author>John Maguire - lulzplzkthx.com</author>
    
    <file name="catalog/controller/common/header.php">
        <operation>
            <search position="before"><![CDATA[$this->render();]]></search>
            <add><![CDATA[
            $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'])
                );
            }
            ]]></add>
        </operation>
    </file>
</modification>
Hope this helps!


Posts

Joined
Tue May 22, 2012 2:13 am

Post by retrobou » Sun Sep 16, 2012 11:38 am

JohnMaguire2013 wrote:Hey guys,

I wrote a quick vqMod script to add the $informations array which can be accessed in footer.tpl to the header.tpl. Simply upload this either through VQMod Manager, FTP, or your method of choice, as add_informations_to_header.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>Add Information module to header template</id>
    <version>1.0.0</version>
    <vqmver>1.0.8</vqmver>
    <author>John Maguire - lulzplzkthx.com</author>
    
    <file name="catalog/controller/common/header.php">
        <operation>
            <search position="before"><![CDATA[$this->render();]]></search>
            <add><![CDATA[
            $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'])
                );
            }
            ]]></add>
        </operation>
    </file>
</modification>
Hope this helps!
Hi there. I have ftp'd to vqmods xml folder, but I am still not seeing links in the header. Do I need to activate it somewhere? I am using version 1.5.4
Appreciate your help.
Thanks!

Newbie

Posts

Joined
Mon Aug 23, 2010 8:19 am
Who is online

Users browsing this forum: No registered users and 117 guests