Add Information block in the header through the vQmod in Opencart



If we are integrating the Custom theme / HTML in Opencart, We want to display the Information block into the Header in place of the Category link. Here is the vqmod script by which you can display the Information block into the header. Follow the steps below:

Step 1 : Use/Copy the code below:

<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>Add Information module to header</id>
<version>1.0.0</version>
<vqmver>1.0.1</vqmver>
<author>EWA-expertwebadvisor.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>

Step 2 : Paste it in the file and save it with the name informationslink_to_header.xml
Step 3 : Upload the add_categoriess_to_right.xml by using the vqmod or directly by using the FTP on this location /vqmod/xml

Step 4 : Copy the below code

<div class="column">
    <h3><?php echo $text_information; ?></h3>
    <ul>
      <?php foreach ($informations as $information) { ?>
      <li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li>
      <?php } ?>
    </ul>
  </div>

Step 5 : Now open the header.tpl by navigating to catalog -> view -> theme -> [your_custom_theme] -> template -> common and Paste the above code at the Top of this file. Refresh the Vqmod cache through the admin panel and you have done.

Hope this will help to someone.