In this Opencart tutorial, we are showing you the difference between the coding structure of a single instance Opencart module and Opencart multi-instance module both in the admin section and the catalog section.
Single Instance Opencart module | Multi-Instance Opencart module |
After installation, it will create only one module | After installation, it can create many modules as many as needed |
![]() | |
Example of core available only one instance Opencart module are: Account module, Category module, Information module, etc | Example of core available multi-instance Opencart modules is: Banner module, Bestsellers module, Carousel module, Featured module, latest module, a slideshow module, special module, etc. |
Admin section code change | |
$this->load->model(‘setting/setting’); | $this->load->model(‘setting/module’); |
$this->model_setting_setting->editSetting(‘module_login’, $this->request->post); | if (!isset($this->request->get[‘module_id’])) { his->model_setting_module->addModule(‘bestseller’, $this->request->post); } else { $this->model_setting_module->editModule($this->request->get[‘module_id’], $this->request->post); } |
Name of the form field should start with the extension initials, for the module, it is like name=”module_*****”, for the shipping extension, it is like name=”shipping_***”, for payment extension name=”payment_***” etc. | Name of the form field can be any |
Data are saved in oc_setting database table | Data are saved in oc_module database table |
Catalog section code change | |
The code difference in the controller is at the index method. public function index() { | public function index($setting) { |
In oc_layout database table, the cod will be stored in the code column | In oc_layout database table, the code dot module id is stored in the code column |
![]() | |
Some other extra codes for multi-instance opencart module are: – Form action link need to be if-else as per module id – Last Breadcrumbs link need to link to module id link Extra code: if (isset($this->request->get[‘module_id’]) && ($this->request->server[‘REQUEST_METHOD’] != ‘POST’)) { $module_info = $this->model_setting_module->getModule($this->request->get[‘module_id’]); } |
These are the differences between a single instance module and a multi-instance module of Opencart. If you are looking for Opencart module development tutorial then here are the two videos and four posts that will help you to understand the code and flow of Opencart modules.
Please let us know if you have any questions or suggestions, please subscribe to our YouTube Channel for Opencart video tutorials and you can see more at Opencart tutorial category. You can also find us on Twitter and Facebook. Enjoy!
It was much informative…Thank you
I have mailed you with a query, kindly check and reply