OpenCart 2.x Modification System
OpenCart Modification System known as OCMOD is a simplified virtual file modification system that is native since OpenCart 2.0. It allows store owners to modify and extend the behavior of their stores, without modifying core files, just by uploading a compressed file containing XML, PHP or SQL files extending the core system files. This approach guarantees trouble-free performance even after the modification is removed.
OCMOD compressed files are uploaded through the Extension Installer and should have a strict folder structure and content.
OCMOD compressed file naming.
Your extension compressed file should have a file extension of .ocmod.zip in order to be uploaded and processed by the built-in Extension installer.
Here is a sample file and its content:
“upload”
The upload folder contains all of the core files of the extension you are about to install.
install.php
This is an optional file containing custom php scripts implementing any post-installation logic if needed.
install.xml
This is the file which describes the changes which your extension will make to the core system files. It also creates a virtual copy of each one of them and performs the described modifications.
Installing an extension containing a modification file
To install a modification, you need to navigate to your store admin panel then open Extension->Extension installer. Click the upload button.
Select the correct modification file from your local drive and click “Open”
This is the place to mention that the Extension Installer requires the FTP to be enabled otherwise it will not work. If by any reason you are having difficulties to set up your FTP in OpenCart you can use the free QuickFix extension, which will solve the issue. More about QuickFix you can read here.
The installer will do the rest. If the upload is successful, you will receive a green success message.
Installing single modification file.
The installation of a single modification file follows the same procedure with the only difference that the file you are going to install should have ocmod.xml file extension. For example if your file is called example.xml in order to install it via the extension installer you need to rename it to example.ocmod.xml. Once you have done that follow the procedure described above.
In order for the modifications to take effect you need to navigate to Extension/Modifications:
After you verify that the modification file is uploaded, all you have to do is refresh your modifications so they can be applied.
Once the file is uploaded you will receive a confirmation in the toolbar as shown below:
Congrats, your OCmod has been successfully uploaded!
It is worth mentioning that in some cases the OpenCart modification system may not work due to some misconfiguration. Here is an article which goes through the most common problem and the way to solve it.