Post by sameverything » Wed Oct 25, 2017 2:26 am

I am fairly new to OpenCart.
I am trying to modify templates etc, but almost ALL tutorials on the internet refer to the old .tpl files.
For example, order_invoice.tpl on old tutorials, I can add a PHP code, read something from the Database, to add , for example, a serial number or a code from my Serial Number database to the invoice.
However, with the new .twig system, I have NO IDEA, how to use these old tutorials.
Even on OpenCart official documentation, there are still references to .tpl and not .twig.

Can someone PLEASE HELP ME?
So in a nutshell I want to know the following:
1) Where are these "variables" being called from? For example, in order_invoice.twig, (or any other file) , how can I add a new "variable" to the file? Where do I define that?
2)HOW do I define the variables used in .twig file on OpenCart system?
3)What's the best practice to follow theming tutorials on the internet, which are using .tpl files? What do I need to know to understand how to use these tutorials in a .twig?
4)Is it worth sticking with OpenCart 3? Or should I use 2.x just because of not understanding how to follow the .tpl tutorials?

Thank you so much guys and girls! I really appreciate it! Also please be nice to me!



Mon Oct 16, 2017 1:00 am

Post by yodapt » Wed Oct 25, 2017 5:28 am

1) The same way like before, the controller passes the data into the view, the only difference is that those keys are replaced by Twig system with the respective keys in the controller;
2) In the respective controller;
3) Should be more or less the same, but you should read Twig's documentation on how to setup variables and logic. If you can manage tpl files, you can manage twig files;
4) The desire to learn will keep you interested in life as long as you live;

Opencart Developer - My Extension Showcase
Contact me at

User avatar
Active Member


Fri Jun 17, 2011 6:39 pm

Post by straightlight » Wed Oct 25, 2017 9:29 am

2) In the respective controller;
Number 2 is not entirely true. There are controllers in Opencart that are only meant to return a variable so that another controller can capture the returned variable before loading the template page.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

Programmer / Opencart Tester

Legendary Member


Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 15 guests