Exploring the code of default Featured Module

To explore the code of defualt featured module, let’s start with listing what files are used by the Featured module:

Admin folder files:

Catalog folder files:

How to know which files are used by module?

Always look to the URL. For Featured module, go to Admin >> Extensions >> Extensions >> Choose “Modules” from the dropdown. Then find the “Featured” and then click the blue Add button (if the module is already installed nor you have to install the module and click the blue button). You will see URL like below:

http://localhost/opencart2302/admin/index.php?route=extension/module/featured&token=LMEWZBoKMxfr1D7s2dhYe5niRfOAz0Ak

See the value of route, here route=extension/module/featured, as this is in admin so your token value may be different.

While seeing for the files always start from the route, the route gives you the controller file and inside the controller, we can find the language file, model file, and template file.

Now as per the route value go to admin folder >> controller folder >> extension folder >> module folder >> and find featured.php file.

In this way, you can find the controller file, controller file end with .php extension. From controller file you can find the language file used by that controller with lines of code as

$this->load->language('extension/module/featured');

It means that admin >> language >> LANGUAGE folder >> extension folder >> module folder  >> featured.php

Like that you can find the language file, language file ends with .php extension.

To find the view file find code that start with $this->response->setOutput. In the featured module it is like below:

$this->response->setOutput($this->load->view('extension/module/featured', $data));

It means that admin >> view >> extension folder >> module folder >> featured.tpl

Like this way you can find the view file, view files end with .tpl extension.

Previous articleThings to consider while creating database Model Data OpenCart Guide
Next articleOpenCart 3 Library Global objects Methods – OpenCart video training
Author of three Opencart book. The recent Opencart 4 book is at https://amzn.to/4dOlbOR

LEAVE A REPLY

Please enter your comment!
Please enter your name here