Notes

How to get and show Information pages in OpenCart

Edit on GitHub

OpenCart

Add the following code to catalog/controller/common/header.php

 1// INFORMATION LINKS
 2$this->load->model('catalog/information');
 3
 4$informations = $this->model_catalog_information->getInformations();
 5
 6foreach ($informations as $information) {
 7
 8	$data['informations'][] = array(
 9		'title' => $information['title'],
10		'link' => $this->url->link('information/information') . '&information_id=' . $information['information_id']
11	);
12}

Now in your catalog/view/common/header.tpl, you can use a foreach loop to get all the information pages out of the array

1<?php if ($informations) { 
2  foreach($informations as $information) { ?>
3    <a href="<?php echo $information['link']; ?>"><?php echo $information['title']; ?></a>
4  <?php } ?>
5<?php } ?>

The getInformations() method provides an array of arrays, with the following details

 1array (
 2  0 => 
 3  array (
 4    'information_id' => '4',
 5    'bottom' => '1',
 6    'sort_order' => '1',
 7    'status' => '1',
 8    'language_id' => '1',
 9    'title' => 'About Us',
10    'description' => '<p>About Us</p>',
11    'meta_title' => 'About Us',
12    'meta_description' => '',
13    'meta_keyword' => '',
14    'store_id' => '0',
15  ),
16)  

It then gets passed along to the template as part of $data