Creating a Custom Page in OpenCart – part 1

Written by in Tutorials on July 21, 2012  |  57 Comments


“How do I create an additional page in my OpenCart website?” That’s likely the question that brought you here. So, here is a simple tutorial for you to begin with. I will assume you already have basic PHP knowledge and HTML knowledge.  If you don’t, not to worry, you can read the comments beside each line to help you understand.

Understanding OpenCart

OpenCart uses a MVC + (L) framework. So basically, you will need a few compulsory files created for it to work.

Required files:

  1. A controller file
  2. A template file

Optional files:

  1. Model file
  2. Language file

Controller File

You will need to first create a controller file in the controller folder. For this tutorial, I will create a file named ‘static.php’ in the /catalog/controller/information/ folder. Since we named the file static.php and put it at information/ folder, the controller class name will be ControllerInformationStatic.

class ControllerInformationStatic extends Controller {
	public function index() {
		$this->language->load('information/static'); //Optional. This calls for your language file

		$this->document->setTitle($this->language->get('heading_title')); //Optional. Set the title of your web page.

		$this->data['breadcrumbs'] = array();
		$this->data['breadcrumbs'][] = array(
			'text'      => $this->language->get('text_home'),
			'href'      => $this->url->link('common/home'),
			'separator' => false
		$this->data['breadcrumbs'][] = array(
			'text'      => $this->language->get('heading_title'),
			'href'      => $this->url->link('information/static'),
			'separator' => $this->language->get('text_separator')

		// Text from language file
		$this->data['heading_title']	= $this->language->get('heading_title'); //Get "heading title"
		$this->data['text_content']	= $this->language->get('text_content');

		// We call this Fallback system
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/static.tpl')) { //if file exists in your current template folder
			$this->template = $this->config->get('config_template') . '/template/information/static.tpl'; //get it
		} else {
			$this->template = 'default/template/information/static.tpl'; //or get the file from the default folder

		//Required. The children files for the page.
		$this->children = array(


So let me explain what’s being done above. In a MVC framework, the controller file is loaded. It is literally the brain of the whole page. It processes and do according to what you asked it to. So “$this->template = $this->config->get(‘config_template’) . ‘/template/information/static.tpl’;” is asking to load for your template file, which will lead us to the next part.

Template File

So, this is one of the required files too. We will create a file named ‘static.tpl’ in the /catalog/view/theme/default/template/information/ folder.

<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content">
	<?php echo $content_top; ?>

	<div class="breadcrumb">
		<?php foreach ($breadcrumbs as $breadcrumb) { ?>
		<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
		<?php } ?>

	<h1><?php echo $heading_title; ?></h1>

	<?php echo $text_content; ?>

	<?php echo $content_bottom; ?>
<?php echo $footer; ?>

So what basically happens above is that it is loading all the things you will see in your browser. It will load your header and footer, which will get the layout of your website. Nothing fancy about it, all your styling is done here. So, you will wonder about those optional files I mentioned, which will bring us to the next part of the tutorial.

Language File

As most of you know, OpenCart supports multi-language. You can have multiple language file in your language folder so that it can be loaded in different language. However, for this tutorial, we will be creating only for the English language. We will start with creating a file named ‘static.php’ in the catalog/language/english/information/ folder.

// Heading
$_['heading_title']	= 'Static Page'; //Add as many as you want, but remember to call for it in the controller file before you can use it in the template

// Text
$_['text_content']	= 'My Static Page Content';

Wondering what the magical line of code above does? Well, it is what the line of code “ $this->data['heading_title'] = $this->language->get(‘heading_title’);” in your controller file is calling for. Without this line, your controller file will not be able to get the words you would like to display.

You can download all files from this tutorial in file below:

Download5331 downloads

So basically, you have successfully made your custom page. You can now access the page you created from Easy as it seems, but you can surely do more with these simple little things, which we will cover in the second part of the tutorial. The second part of the tutorial will cover on using the model files and search engine optimization.

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

57 Comments on "Creating a Custom Page in OpenCart – part 1"

  1. Ali July 20, 2015 at 12:08 am · Reply

    is it possible to include an another php file with this static files ? and how can i do it ?

    i need to add UberGallery script in my opencart store as a image gallery, but im not understand this MVC system

  2. Harbindra Singh June 16, 2015 at 12:57 pm · Reply

    As a store honer I want to make a seller information page on which I want to put some link related to video (like packaging, product upload etc ). When a vendor/seller click that link, video start to download. Is it possible with OpenCart? I have no knowledge about PHP, JavaScript, CSS or other.
    plz help me. If above possible plz sent me the way, on my email address.

    • Preet Rajput June 19, 2015 at 6:56 pm ·

      Hello Harbindra,

      Yes it’s possible but i need to deeply understand your requirement so explain properly what do you want.

  3. economia March 6, 2015 at 6:03 pm · Reply

    Oh my goodness! Impressive article dude!
    Thank you so much, However I am experiencing problems with your RSS.
    I don’t know the reason why I am unable to join it.
    Is there anybody else having similar RSS issues? Anybody who knows the answer can you kindly respond?

  4. Prabal Tam March 1, 2015 at 12:40 pm · Reply


    I am trying to create a custom pages as per your code presented, but getting error, i am using opencart v2.0.1.1 , pls. help.

  5. cosmos January 23, 2015 at 6:26 am · Reply

    I’m getting this error on the latest opencart

    Notice: Indirect modification of overloaded property ControllerInformationStatic::$data has no effect in /var/www/html/upload2/catalog/controller/information/static.php on line 8Notice: Indirect modification of overloaded property ControllerInformationStatic::$data has no effect in /var/www/html/upload2/catalog/controller/information/static.php on line 9Notice: Indirect modification of overloaded property ControllerInformationStatic::$data has no effect in /var/www/html/upload2/catalog/controller/information/static.php on line 14Notice: Indirect modification of overloaded property ControllerInformationStatic::$data has no effect in /var/www/html/upload2/catalog/controller/information/static.php on line 21Notice: Indirect modification of overloaded property ControllerInformationStatic::$data has no effect in /var/www/html/upload2/catalog/controller/information/static.php on line 22

    • Klaas July 28, 2015 at 9:46 am ·

      the same problem for my. Can sombody help??

    • Gayan October 1, 2015 at 10:23 am ·

      replace “$this->data” with “$data”

  6. Custom shipping crates December 10, 2014 at 5:08 am · Reply

    Good day! This post couldn’t be written any better!
    Reading this post reminds me of my good old room
    mate! He always kept talking about this. I will
    forward this page to him. Pretty sure he will have a good read.
    Many thanks for sharing!

  7. dead trigger 2 cheats online December 3, 2014 at 9:38 pm · Reply

    It sports the most innovative technology and enjoying part of
    a product and decide if it is a tough time bound schedule.
    Mobile phones by all companies now come with most cell phones.

    Technically the game being played, using data cable or dead trigger 2 hack blue tooth technology.

  8. November 26, 2014 at 12:09 pm · Reply

    Good article. I’m facing some of these issues as well..

  9. Wilton Manors November 22, 2014 at 6:31 pm · Reply

    My co-worker recommended this site from a post he read the other day. I’m glad he did! Thanks!

  10. Sumeet October 16, 2014 at 4:03 am · Reply

    Hey author
    Amazing read. Thanks a ton. It’s difficult to find a good read for opencart like this one.
    For beginners like me it was a road map.
    Looking forward for more such basics. Also you can take detailed example on common requests. Thanks again

  11. Felix October 13, 2014 at 10:02 pm · Reply

    When someone writes an article he/she keeps the plan of a user in his/her brain that how a user can know it.

    So that’s why this article is outstdanding. Thanks!

  12. ipa uno download October 12, 2014 at 10:10 am · Reply

    I think this is one of the most significant information for me.
    And i’m glad reading your article. But want to remark
    on some general things, The site style is ideal,
    the articles is really excellent : D. Good job, cheers

  13. September 7, 2014 at 8:32 pm · Reply

    Good info. Lucky me I discovered your website by accident (stumbleupon).
    I have book marked it for later!

  14. parth June 15, 2014 at 5:23 am · Reply

    very nice tutorial
    Plese suggest me how to create page in opencart front in accout folder.

  15. behghool June 9, 2014 at 5:59 pm · Reply

    thank you for this very interesting topic, actually I want to create a page like this but in account page, I mean such as the pages that customer needs to log in before can access to it.

    any help?

  16. neddy April 23, 2014 at 2:19 pm · Reply

    hi. does anyone know how to create custom layouts for o.c i want to add unique banners to particular unique subcategories. but need to create custom layouts for those particular subcategory pages. can anyone assist with that? thank you

  17. April 18, 2014 at 9:14 pm · Reply

    I always spent my half an hour to read this web site’s
    articles daily along with a mug of coffee.

  18. Arthur Franco April 2, 2014 at 3:32 am · Reply

    Thank you! Easy to install and it’s working on Opencart v1.5.6.1

  19. mark March 12, 2014 at 8:34 am · Reply

    thanks for this tutorials. got it! :)
    btw, i am a newbie in opencart and posting this sh*t here helps me a lot. Cool! :)

  20. devendra February 25, 2014 at 5:23 am · Reply

    thanks its working.. but still m unable to fully understand how the codes of opencart :(

  21. Everton February 4, 2014 at 5:57 pm · Reply

    Thanks for your help man. Just a bug. Everything is working fine in opencart there is just the problem that when you access the static page I uploaded and my custom page I got the $column_left code under my menu. You can see it accessing
    Can you help me to fix it?

  22. Juan October 21, 2013 at 12:11 am · Reply

    Does this work on Opencart 1.5.6 ?

  23. God Father {BuTy BrotheRs} September 27, 2013 at 6:18 am · Reply

    I gotta two questions running in my mind.

    1. is it possible to make only controller file that pass data on the theme/default/common/header.tpl

    2. Lets say I created a dynamic css named stylesheet.php in the catalog\view\theme\theme_name\stylesheet\
    So I wanna know,
    is it possible to pass the array of value from any controller file to stylesheet.php ??

    help me through this I was searching for these answers so long. Any help should be appreciate.

  24. Robert August 27, 2013 at 10:21 pm · Reply

    I’m getting an error:

    Notice: Error: Could not load template /home/layercak/public_html/layercake-store/catalog/view/theme/default/template/information/thankyou.tpl! in /home/layercak/public_html/layercake-store/vqmod/vqcache/vq2-system_engine_controller.php on line 76

    Am I missing some additional steps?

  25. irfan April 23, 2013 at 10:37 am · Reply

    where is admin ?

    • Aaron June 4, 2013 at 5:55 pm ·

      You wont need admin panel. Just go to System > Design > Layout and design a layout and assign this address to it information/static. Now you can display any module on that layout in content top, content bottom, column left and column right. Awesome tutorial.. totally worked for me on

  26. irfan April 16, 2013 at 10:20 am · Reply

    Can i call on specific categories on footer using php not a custom ..

  27. dilip April 11, 2013 at 6:15 am · Reply

    Its not working on opencart please help!

  28. Erkan Yilmaz March 25, 2013 at 2:09 am · Reply

    Does this tutorial work in OC I tried several times but it doesn’t seems to work.

  29. Cleo February 24, 2013 at 4:59 am · Reply


    I want to thank you for this great and easy tuto.
    Just one thing I downloaded the files but couldn’t extract them because they are password protect.

    So I had to create my own files but it’s working perfectly.


  30. Anuj February 14, 2013 at 7:10 am · Reply


  31. François December 7, 2012 at 11:03 am · Reply


    Got it a few minutes ago and works wonders, thanks!!

    I was wondering how I could have this new page show a different header than the rest of the pages? I want this page not to show the shpping cart for instance, and not to show either the categories menu: in fact, I need this page to be my welcome page, and as such not show anything oriented to selling but for a link called “Go to the online shop” in the header menu; the rest would be only information about my products…


    • MarketInSG December 7, 2012 at 11:05 am ·

      you can do so easily by remove and replace it with your own design there

  32. Emanuel November 1, 2012 at 12:33 pm · Reply


    I don’t know how do I link this page to my menu bar

    The result looks like this
    but how I access this link prom my page directly just like I access the home page?

    Thank you

    • MarketInSG November 1, 2012 at 12:35 pm ·

      just add a link to your footer or something will do

    • Emanuel November 1, 2012 at 1:49 pm ·

      Can you be more specific please?

      I want that page to show up in the menu bar where the categories are. What should I do for that?


    • MarketInSG November 1, 2012 at 2:13 pm ·

      in catalog/view/theme/*/template/common/header.tpl find and modify from there. it depends on your theme.

    • Emanuel November 1, 2012 at 2:29 pm ·

      Thanks. I’ll try to find what I should modify. My theme is the default theme just with a background and some different colors.

    • Emanuel November 1, 2012 at 2:33 pm ·

      I believe somewhere in this part of the code I must insert the link for the static page.

      <a href="”>

      <?php for ($i = 0; $i

      <?php for (; $i

      <a href="”>

    • Emanuel November 1, 2012 at 2:48 pm ·

      Thanks for the help.:D

  33. kostis September 24, 2012 at 1:37 pm · Reply

    I have made the same thing that you have posted. You can see the link here:

    I don’t know why i experience this problem if you need something else please send me a message.
    As you can see i am using Basico theme…..

  34. kostis September 21, 2012 at 1:28 pm · Reply


    I have a problem with my custom pages!! I cannot see the quantity at the cart…… Please help me i think there is a problem in the controller file…


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

      That depends on how you coded it. maybe you can show how you coded?

  35. Svemirko September 20, 2012 at 10:25 am · Reply

    How can I add things to column right for example (I’d like to have categories shown), on a custom page like this one?


    • MarketInSG September 20, 2012 at 10:27 am ·

      You will have to add additional layout. You can add layout from admin panel system > design > layout

    • Svemirko September 20, 2012 at 10:46 am ·

      Of course!
      Thanks again! :)

  36. whereissecondpart August 28, 2012 at 5:58 am · Reply

    where is the second part?

  37. MarketInSG August 25, 2012 at 4:17 am · Reply

    Part 2 will be out in a week! Stay tune!

  38. MarketInSG August 23, 2012 at 4:03 am · Reply

    Soon, no worries :)

  39. Sulfy August 10, 2012 at 7:47 pm · Reply

    wend it second part?

Trackbacks for this post

  1. How to create new pages? | Open Cart Know How
  2. Creating a Custom Page in OpenCart – part 2 - OpencartNews

Leave a Comment

comm comm comm