What is the difference between modules and extensions in OpenCart?
In computer software, the terms "module", "extension", "plug-in", "add-on", "app", and even "vQmod" (in OpenCart only) are often used interchangeably. In most cases this is fine and doesn't really cause any problems. In common parlance, all of these terms tend to refer to a bit of computer code that can be added or "plugged-in" to an existing piece of software to extend it and give it more functionality.
Often though, when working in a complex industry, terms need to be given more specific definitions to allow for precise and accurate communication. The world of OpenCart is no exception, and here, "module" and "extension" refer to very different things.
What is a module in OpenCart?
Modules in OpenCart are little blocks that disiplay something (such as a list of Categories) and can be positioned in various places on the templates. They can be found by going to Extensions > Modules in the admin:
Each module can be edited to adjust some settings and options in here. To add it to a page on the site, you have to know what Layout the page you want it to appear on is using. So to apply the module which lists Categories to the Category page you would go to Design > Layouts, find the Category layout and add the Category module to the left column like this:
Once that's done, your Category Module will appear here:
And that is a module in OpenCart, nothing else!
What is a vQmod in OpenCart?
This isn't a technical article aimed at developers but the concept of a vQmod is incredibly simple and can be explained to the layperson easily enough: OpenCart is an open source platform so all of the computer code is accessible to any developer who wants to make a change (if they have access to your server of course). To add a new feature or change something, it's possible to change this code directly but this is a bad idea because an upgrade of the software would wipe the change. Also, if an extension worked by replacing files, only one extension could be installed at a time - not a workable solution.
vQmod was designed to overcome this problem and is a system where a developer can write a list of changes to the code that will be automatically applied to a copy of the file when the extension is installed. Almost any part of the OpenCart code can be changed this way, leaving the core code un-touched. Not a bad solution and it works well in practice.
So, to be clear, a vQmod is one XML file (i.e. ends .xml and containssimilar to HTML) which lists changes to be made to spefic core OpenCart files. Not all extensions use this and if they don't modify any core files then this is not a problem.
vQmods live in the /vqmod/xml folder:
So what is an extension in OpenCart?
An extension is bigger than a module and a vQmod. One extension may contain one or many modules and/or themes and/or vQmods. But what is it? In OpenCart, it's just a zipped folder that contains the above, usually in a folder called "upload".
Via FTP when a folder is uploaded, the contents are usually merged rather than replaced. The upload folder can contain folders that match the OpenCart folders, such as /admin /catalog and /system as well as vQmods in a /vqmod folder. With any luck, outside the upload folder, the extension will also contain helpful documentation in the form of a readme file, PDF, or HTML manual. It should also contain the contact details of the developer.
To conclude, an extension in OpenCart is a zip file, that contains files to be uploaded to an OpenCart installation and may include modules, themes, vQmods or even stand-alone code that runs in a sub-folder of your store. A module is a small layout block that can be configured in the admin.
What did you think of this article? Have I missed anything important? Let us know in the comments?blog comments powered by Disqus