vQmod (OCMod)

“vQmod” (Virtual Quick Mod) is an override system designed to avoid having to change core files. The concept is quite simple… Instead of making changes to the core files directly, the changes are created as xml search/replace script files. These script files are parsed during page load as each “source” core file is loaded with the “include” or “require” php functions. The source is then patched with the script file changes, and saved to a temp file. That temp file is then substituted for the original during execution. The original source file is never altered. This results in a “virtual” change to the core during execution without any actual modification to the core files

How it works ?

Instead of modifying actual files to add custom modifications, source files are parsed “on-the-fly” right before any of the follow functions are called :

  • include()
  • include_once()
  • require()
  • require_once()

The source is then cloned to a temp file and modifications read from an external script file are made to that temp file. The temp file is then substituted for the real file in the include path. Now the modification is in place while the original file has not actually been altered. Remove the script file and the original source is loaded.

vQmod class is currently written in PHP and script files are xml based, but the concept could be ported to any language and parse could be created for any format. Opencart is only fully tested and working platform that vQmod works with, but this is a concept that can work for other projects and platforms that are controller-based.

There are some files that cannot be used with vQmod :

  • index.php – this is the main file of the Opencart site, it has to load vQmod first for it to work on other pages. So you can’t put the cart in front of the horse.
  • Standalone files – Files that are just standalone and don’t extend or have no hierarchy will not work with vQmod. vQmod works by intercepting the “include” functions. So if file isn’t being included or required, then it cannot be vQmodded
  • css & js files – These files are rendered at the browser level, not at the server level, so vQmod has no effect on these. You can, however, create new files and use vQmod to alter the tpl files to point to these new css/js files. Or you can put.


Create a vqmod file from here