Adding New Modules Positions

Written by in Tutorials on September 17, 2012  |  65 Comments


Many of us look to adding more positions for us to display our modules. Let’s take my website as example. Scroll to the bottom of the page, do you see a Facebook like box at the bottom? Well, I can easily display modules on page footer now because I added new positions. So here is a simple tutorial to guide you through. Adding new positions for your modules had always been your dream right? It’s a dream come true for you now!

Getting Started

There’s a few things that you will need:

  1. Basic PHP Knowledge
  2. Basic HTML Knowledge
  3. Basic CSS Knowledge
  4. Text editor

Creating New Position (Controller File)

First, you will have to create a new position. I shall create a PHP file and name it ‘content_footer’. This file should be placed in ‘catalog/controller/common/’ folder.

Next, you will just have to simply paste the following codes in.

class ControllerCommonContentFooter extends Controller {
	public function index() {

		if (isset($this->request->get['route'])) {
			$route = (string)$this->request->get['route'];
		} else {
			$route = 'common/home';

		$layout_id = 0;

		if ($route == 'product/category' && isset($this->request->get['path'])) {
			$path = explode('_', (string)$this->request->get['path']);

			$layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path));

		if ($route == 'product/product' && isset($this->request->get['product_id'])) {
			$layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);

		if ($route == 'information/information' && isset($this->request->get['information_id'])) {
			$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);

		if (!$layout_id) {
			$layout_id = $this->model_design_layout->getLayout($route);

		if (!$layout_id) {
			$layout_id = $this->config->get('config_layout_id');

		$module_data = array();


		$extensions = $this->model_setting_extension->getExtensions('module');

		foreach ($extensions as $extension) {
			$modules = $this->config->get($extension['code'] . '_module');

			if ($modules) {
				foreach ($modules as $module) {
					if ($module['layout_id'] == $layout_id && $module['position'] == 'content_footer' && $module['status']) {
						$module_data[] = array(
							'code'       => $extension['code'],
							'setting'    => $module,
							'sort_order' => $module['sort_order']

		$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'] = array();

		foreach ($module_data as $module) {
			$module = $this->getChild('module/' . $module['code'], $module['setting']);

			if ($module) {
				$this->data['modules'][] = $module;

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/content_footer.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/common/content_footer.tpl';
		} else {
			$this->template = 'default/template/common/content_footer.tpl';


Wondering what all those codes above do? It checks if this is the right layout AND if any extension is to be placed at ‘content_footer’. If there is, it will grab the extension and display it in the template file of content_footer.tpl. So, this means we will need to create a template file for this new module position.

Creating New Position (Template File)

Now, you will have to create a new template file named ‘content_footer.tpl’. This time, the file will be placed at ‘catalog/view/theme/default/template/common/’ folder. Simply paste the codes below into the new template file you had just created.

<?php foreach ($modules as $module) { ?>
   <?php echo $module; ?>
<?php } ?>

Nothing much is actually done here. It just display the modules that is called from the controller file. Simple isn’t it? So now you are almost done! You have set up a new position for your modules. Now, it’s time to link them to your pages.

Linking It Up

Open up and edit catalog/controller/common/footer.php and find


before it, add

$this->children = array(

With this extra line, you have linked up the new module position with your footer. Now, to display it at the footer, you will have to edit the footer’s template. Open up and edit catalog/view/theme/default/template/common/footer.tpl and find

<div id="powered"><?php echo $powered; ?></div>

before it, add

<?php echo $content_footer; ?>

If you have reached this part of the tutorial, great! You have managed to set up a new position for your modules. Now all you will have to do is to add any modules to that position. Some simple changes will be required for this to be done.

Assigning Positions To Modules

For this task, it will be quite simple. Open up the template files of any modules that you would like to display at the new position. Let’s say I would like to display the Featured Module at Content Footer, I will open up admin/view/template/module/featured.tpl and find

<?php if ($module['position'] == 'content_top') { ?>
   <option value="content_top" selected="selected"><?php echo $text_content_top; ?></option>
<?php } else { ?>
   <option value="content_top"><?php echo $text_content_top; ?></option>
<?php } ?>

before it, add

<?php if ($module['position'] == 'content_footer') { ?>
   <option value="content_footer" selected="selected">Content Footer</option>
<?php } else { ?>
   <option value="content_footer">Content Footer</option>
<?php } ?>

Now, find

html += '      <option value="content_top"><?php echo $text_content_top; ?></option>';

and before it add

html += '      <option value="content_footer">Content Footer</option>';

By adding those codes, you have a new position ‘Content Footer’ for the Featured module . Select and save the module, you should now see the extension at the new position. Simple isn’t it? You can create more positions and place them around your website if you would like to. It’s not that tough, but do remember, you cannot have the positions named the same!

Tags: , ,

About the Author

Joined OpenCart community since November 2011. MarketInSG is Singapore's first website dedicated to OpenCart web designing & modification.

View all posts by

65 Comments on "Adding New Modules Positions"

  1. la pilule phenq October 16, 2018 at 8:56 am · Reply

    Quality content is the secret to attract the visitors to pay a quick visit the site, that’s what
    this website is providing.

  2. dave November 19, 2017 at 2:23 pm · Reply

    please does this work for opencart

  3. Uziel June 20, 2016 at 2:30 am · Reply

    In Joomla, you need only change or add in the index.php of the template:

    Opencart is a CMS maded by childrens.

  4. tugce January 30, 2015 at 2:41 pm · Reply


    How can we create a position for the version?

    Thank you in advance for your help

    • josh March 5, 2015 at 5:46 am ·

      I would like to know this as well please!

  5. ajay October 4, 2014 at 12:15 pm · Reply

    thnaks to u u saved me

  6. camcamri July 27, 2014 at 5:57 pm · Reply

    Hi, nice tutorial! But I only can see the module on ‘home’. How to see it all along the oc site??

  7. kernelbit July 25, 2014 at 4:05 pm · Reply

    Hi, nice tutorial! I did it on with Fashionista Street template, but the new module position only shows in Home footer, what’s wrong? Thanks..

  8. herry candi July 2, 2014 at 2:36 pm · Reply

    thank you, it’s very helpfull. God Bless u

  9. rea May 22, 2014 at 12:38 pm · Reply

    We are a group of volunteers and opening a new scheme in oour
    community. Your site offered uss with valuqble infofmation to work on.

    You have done a formidable job and our whole community will be grateful
    to you.

  10. mudit from india May 18, 2014 at 7:33 am · Reply

    u r realy nice

  11. May 15, 2014 at 1:31 pm · Reply

    A reality which can not be achieved while working with, or investing in, any corporation where corporate greed overrides
    the needs of the employees or investors in
    same. Many parents make sacrifices, such as lowering their standard of living,
    in order for one parent to stay home, which would make such a policy a moot
    point. If it is impossible to match the
    shades, the best choice is a shade like taupe or soft brown,
    which gives a natural look rather than nude or opaque shades, which are usually too light, or darker shades, which create too great a
    contrast between the legs and the hemline.

    My web-site pawn stars gold and silver pawn shop las vegas (

  12. May 5, 2014 at 6:05 pm · Reply

    You could try a silver or gold liner over the inner corner of your eyes
    for that fairy like effect. Cleanliness is an important component of make
    up and skin care procedure. When you think about it, you will
    be applying your foundation when you are turned sideways.

    Feel free to visit my homepage;

  13. R G March 19, 2014 at 4:33 am · Reply

    Thanks a lot MarketInSG.. This is the best and easiest article I found online regarding creating the new module positions. Also adding a vqmod option would be also handy for those who doesn’t like the core files to be edited.

  14. God Father {BuTy BrotheRs} December 13, 2013 at 6:57 am · Reply

    Hii Everyone,

    I just wanna know How much time it will take to activate the “Seller Account ” In

  15. Tony November 20, 2013 at 5:23 pm · Reply

    Hi guys

    Wanted to ask you if you can tell me anything about this module. They say its unlimited positions – so i can create them in admin. does anyone know how it works?


  16. Simon November 17, 2013 at 3:45 pm · Reply

    Thank you! This works perfectly. Now I can put modules exactly where I want them inside the content on any template

  17. how do you get rid of pimples October 20, 2013 at 2:09 pm · Reply

    Good day I am so excited I found your weblog, I really found you by accident,
    while I was looking on Askjeeve for something else,
    Nonetheless I am here now and would just like to say thanks
    a lot for a remarkable post and a all round interesting blog
    (I also love the theme/design), I don’t have time to look over
    it all at the moment but I have bookmarked it and also added in your RSS
    feeds, so when I have time I will be back to read more,
    Please do keep up the superb b.

  18. planetvegan.Com September 15, 2013 at 7:29 pm · Reply

    I every time emailed this webpage post page to alll my contacts, for the reason that if like to
    read it afterward my contracts will too.

  19. Bigso September 3, 2013 at 9:24 am · Reply

    So good for this tutorial.

  20. punthai September 1, 2013 at 10:33 am · Reply

    yes! this post success. it ok buy need use with css for manage new position
    verry thank.

  21. Maybelle July 16, 2013 at 10:46 pm · Reply

    You really make it seem so easy with your presentation but I find this matter to be actually something which
    I think I would never understand. It seems too complicated and extremely broad for me.
    I’m looking forward for your next post, I’ll try to get the hang of it!

  22. Dagmar June 24, 2013 at 10:41 am · Reply

    Thanks a lot for the tutorial, it’s very helpful!
    There is just one thing: it seems that the new position is just available one time.
    I tried to add the module (‘featured’ as in your example) additionally to another page (account) but I didn’t get the newly assigned position.
    Did I miss something?

    • Dagmar June 24, 2013 at 10:50 am ·

      indeed, I missed the last step. Thanks again.

  23. Canon SX240 HS reviews June 15, 2013 at 10:43 am · Reply

    Hi there, its fastidious post on the topic of media
    print, we all understand media is a wonderful source of data.

  24. Neeraj June 11, 2013 at 11:25 am · Reply

    Thank u very much for this helpful tutorial.
    i want to add new position for slideshow in header section so that i can add in left side vertical menu and rest side i want to add all product module.
    .i follow your all steps here you defined.but it show me a error like Notice: Error: Could not load template C:\xampp\htdocs\shopnow/catalog/view/theme/skunhare/template/common/content_had.tpl! in C:\xampp\htdocs\shopnow\system\engine\controller.php on line 70..
    i made a tpl file named content_had.tpl
    in controller.-> content_had.php and i also include it into header.php
    in admin section i apply this method and i get new position there.

  25. Hi there i am kavin, its my first time to commenting anyplace, when i
    read this piece of writing i thought i could also make comment due to this brilliant post.

  26. suhas May 23, 2013 at 6:03 am · Reply

    nicely done ….very helpful o beginer

  27. fast and furious 6 May 15, 2013 at 10:08 pm · Reply

    It’s difficult to find educated people about this subject, but you seem like you know what you’re talking about!


  28. Vishal Bhimjiyani April 18, 2013 at 2:26 pm · Reply

    Thanks you !!! code was really helpful to create position in easiest way…

  29. Marty April 14, 2013 at 11:08 am · Reply

    I always spent my half an hour to read this webpage’s posts daily along with a cup of coffee.

  30. cao April 11, 2013 at 12:57 pm · Reply

    the last step:
    go into admin –> module –>featured (edit) change the position to content footed.

  31. Wendy April 5, 2013 at 9:02 am · Reply

    Thank you so much for this tutorial. Worked perfectly and everyone is happy.

  32. Joost March 19, 2013 at 4:36 pm · Reply

    Great tut!

    Very usefull and also applies to OC 1541

  33. Yshai February 6, 2013 at 3:35 am · Reply

    Does it work like this?

  34. Edin January 20, 2013 at 9:19 pm · Reply


    I have followed this tutorial but I am having problems with the following error:
    Notice: Undefined variable: banner_category in /home/computercenter/public_html/catalog/view/theme/computercenter/template/product/category.tpl on line 8

    I have renamed content_footer to my own position and defined it everywhere it should be, but still problem remains.

    Any help?

    Thank you

  35. Will January 12, 2013 at 3:23 am · Reply


    Thanks for the great tutorial. I tried with one module position, it is working well. However, when I try to add the second module which I repeat the same steps and change the name accordingly, I have the error
    Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION
    I duplicate the code from previous working module. The only different is the name(position/php/template name) and insted of
    $this->children = array(
    I write it as
    $this->children = array(

    Can you please advise on this error? Thanks!

    • MarketInSG January 12, 2013 at 3:28 am ·

      when you want to add new modules to the same place, just repeat the last step by modifying the modules to add in ‘content_footer’

  36. Vladimir January 10, 2013 at 11:53 am · Reply

    You are right, just did it and everything its OK, I was forgot to do that I think that is enough to do it in template.

  37. Vladimir January 10, 2013 at 10:57 am · Reply

    Hi, tutorial is great, but not working for me. I did everything you wrote, but nothing. I dont receive any warning, just this not working for me. Does it have any relations with theme different than default opencart. I have fortuna premium theme and not working, beside I tried and with default theme and nothing. Is there any way to debug whts wrong?
    Thank in advance!

    • MarketInSG January 10, 2013 at 11:34 am ·

      If you didn’t add any modules to the content_footer position, nothing will show up of course.

  38. tinhntit January 4, 2013 at 4:42 am · Reply

    Notice: Undefined variable: content_footer in /home/halomobi/ on line 54

    • MarketInSG January 4, 2013 at 6:52 am ·

      you missed things out…duh?

      $this->children = array(

  39. Hubertus December 24, 2012 at 12:21 pm · Reply

    Can you tell me if this tutorial does the same as this extension

    • MarketInSG December 25, 2012 at 2:28 pm ·

      Not exactly the same but similar.

  40. snezanna December 13, 2012 at 9:02 pm · Reply

    Thanks a lot! All works and simple done! Very usefull article!!!

  41. Miguel November 7, 2012 at 8:57 am · Reply

    Hi, upon completion of the manual, Where does the new position? I mean in the admin panel. thanks

    • MarketInSG November 7, 2012 at 9:05 am ·

      you have to manually add it. it’s written above where you have to add new position to your modules manually

    • Miguel November 8, 2012 at 9:01 am ·

      Thanks, I have been very useful to the manual as its answer, keep in touch!

  42. Humayun October 17, 2012 at 11:12 am · Reply


    Thanks for this tutorial. but i am having a problem i dnt know why i have just copied and pase this code but i am having a parse error.

    Parse error: parse error, expecting `T_FUNCTION’ in D:\wamp\www\BuyDesign\catalog\controller\common\content_footer.php on line 4

    • MarketInSG October 17, 2012 at 11:13 am ·

      You can try downloading the example :)

    • Humayun October 17, 2012 at 11:26 am ·

      Thanks For reply. i am not able to find a download link Would you please Thanks Again ..

    • Humayun October 17, 2012 at 11:34 am ·

      And one thing more i have change default url to friendly SEO so will it going to effect this code or not? because i am seeing that in your code there are checks against route’s which are default url of open cart Thanks

    • MarketInSG October 17, 2012 at 11:51 am ·

      it won’t affect. And base on the error you gave me, line 4 of my codes doesn’t seem to have any error. You should try copying again or type them out.

    • Humayun October 24, 2012 at 2:48 pm ·

      i did this article for Content Header and now i can see a Content Header in slideshow module. after selecting it and saving it i am not able to see a slideshow in my header. Can you please tell what could be the reason, because it is not displaying an error though. Thanks

    • MarketInSG October 26, 2012 at 2:32 am ·

      You might want to check for javascript error. alternatively, try using other modules to display, like the account module.

  43. Bingori October 15, 2012 at 10:49 am · Reply


    Thanks for this tutorial. If i had read it before, i might have not bought this extention. still it did the trick –

  44. Ljubo September 22, 2012 at 3:12 pm · Reply

    my bad.

    everything is ok now, thank you for your help!
    since I was changing file by making a vqmod, the error was copying the full code of:
    $this->children = array(

    insted of only:

    off course, this is valid only for header posittion modification.

    thank you!

  45. Ljubo September 21, 2012 at 10:08 pm · Reply


    I did like you said plus changed the word footer into header through all the stages you pointed.
    but am also having some strange problems, like warning messages – undefined variables of language, of currency, of cart, all for header.tpl.
    majority of your coding I have put in an xml file (vqmod), and if I disable this vqmod file, the warnings dissapear.
    perhaps the problem could be some conflict with other vqmods of mine, I dont know.

    • MarketInSG September 22, 2012 at 1:56 am ·

      For the first part, it says create new files. So just copy and paste the exact codings, leaving it as content footer. That should be easy to you. Just copy and paste will do.

      So in header, find $this->children = array( and below it ADD ‘common/content_footer’. Since header already has those children array, we add in ‘common/content_footer’ instead of replacing the whole array.

      Now, in header.tpl file, place at a place you want it to be.

      For the admin side, it will be the same. No changes. There, you should have content_footer position at your header instead.

      I have an extension that is similar to this tutorial I had written

  46. Ljubo September 21, 2012 at 1:00 pm · Reply

    Thank you for the excellent tutorial!

    Do you perhaps have some advice on putting the module inside header.tpl, not before or after, but inside of it?

    • MarketInSG September 21, 2012 at 1:01 pm ·

      you can just instead of adding to footer.php, add it to header.php, starting from ‘Linking It Up’

Trackbacks for this post

  1. Adding new module position | Open Cart Know How

Leave a Comment

comm comm comm