How to Develop Opencart Modules

What Are OpenCart Modules?

OpenCart modules are analogous to add-ons, plugins, or extensions in other content management systems. It’s through modules that OpenCart gives us the ability to extend its functionality without having to edit the application’s files.

As with many other content management systems, it’s generally considered to be a best practice to extend functionality of the core application through the provided APIs and OpenCart is no different. Modules allow us to introduce, remove, or modify functionality of the core application that’s done in a compartmentalized and maintainable way.

OpenCart has its own Extension Market where a large number of extensions are already available. 

To take things a step further, we’re going to look at creating a custom module for OpenCart.


Our First Module

To get started, perform the following:

1.   Create an Controller to Admin

Path: admin/controller/extension/module/popular.php .

2.   Create a Language File to Admin

Path: admin/language/en-gb/extension/module/popular.php .

3.   Create a View to Admin Path: admin/view/template/extension/module/popular.twig .

1. The Language File

As discussed in our previous articles, the language file contains the static text what should be displayed in our view file. For the popular.php language file, the following variables contain the possible text fields what we require to display in our module:


1. The Controller

Open the “popular” controller file that we just created and add the class class ControllerExtensionModulePopular {}following the Class Naming Convention. Next, place the following code inside the class






Step 2: Validation Method

As we tried to validate data on save in default function. So here comes the validation method.


3. View File

As previously done in controller, you have to create some HTML for the view. For that, we’ll do the following:


Step 4: At this point, we’re done preparing our first popular module. At this point, it’s time to check whether our module is working or not. 

To do that, login to dashboard and go to the Extensions Tab->Extensions page where you’ll see option Choose the extension type and select modules from the dropdown.


There will also be “popular” listed with an “Uninstalled” State, click on “Install” and try editing the module and you’ll see a screen something like this:



In this article, we tried to build a basic OpenCart Module using MVC. It’s easy to manipulate OpenCart Modules if you’re familiar with the core concepts of MVC. This article gives just a basic idea how to develop a simple module following some simple steps.



Leave a Reply

Your email address will not be published. Required fields are marked *

Social Media

Most Popular


Related Posts

Set your categories menu in Theme Settings -> Header -> Menu -> Mobile menu (categories)
Create your first navigation menu here
Shopping cart
Start typing to see posts you are looking for.

We are a well-established organization and are being
managed by a team of IT professionals for more than 7
years. We are a one stop destination for Web & App
Development services.

Our Location

N2R TECHNOLOGIES, C-6 Sector 7, Noida, Uttar Pradesh 201301 (India)

Contact Info


Follow Us On