How to use OpenCart modifications system

OpenCart modification system (OCMod) is technology which has goal to give ability to extensions (theme) developers to make modifications of OpenCart core files without their direct modification. This approach makes possible update OpenCart without losing modifications and protects core files from unintentional damage by inept developers.  It is achieved by saving copy of modified core files under "/system/storage/modification/" folder. So each time, before get access to core file, system firstly checks whether modified version of that file exists and uses it instead of original file.

This system was presented in OpenCart 2 as a built in substitution of VQMod system. In order to make modifications in core files an extension developer should supply XML file with list of all modifications. This file should have extension .xml and may be stand alone or placed inside of an extension package file (the one with extension .zip). Modifications install in system via OpenCart Extension Installer. After modification was installed into system you need to proceed to Modification page (Admin Panel > Extensions > Modifications fig 1) and apply that modifications.

OpenCart modifications page

Figure 1. OpenCart modifications page

When new modification was installed into system it will appear in "Modification List" under "General" tab. In this list you may see name, author, version, status, link to author site (if present) and installation date for each of installed modification. To apply newly installed modification you need to click "Refresh" button. Only enabled modifications will be applied. In order to change modification status you need to click on button with minus/plus sign into it (depend on modification status) at "Action" section of corresponding modification.

All actions on modification such as install, delete, enable or disable operates with modification record in database (add/remove record, change status) without any impact to modified copies of core files. When you refresh modifications system clears out all existing modified copies of core files, fetches all enabled modifications from database and creates new copies of core files which should be modified. So that is why you need to refresh modification each time you install, enable, disable or remove modification.

To disable OCMod system totally you need to click "Clear" button without subsequent refresh of modifications. It will remove all the modified copies of core files so original core files will be used.

If you can't refresh modifications and don't know which modification cause the error open "Log" tab of "Modification list" (fig 2). Modification pertaining to the last entry in the log is likely to be a cause of the error. Modification name is signed "MOD" label.

OpenCart OCMod log file

Figure 2. Modification log