ocmod

OCMOD quick install guide

Starting from OpenCart version 2 we have this  system that enables us to modify a site by uploading a compressed file that contains XML, SQL and PHP files. That system is called OCMOD and it is based upon Qphoria’s vQmod system. Despite different installation procedures, both vQmod and OCMOD are using the same method to make file modifications within OpenCart platform. OCMOD is available within OpenCart starting from version 2.x and can be found in Dashboard under Extensions option.

OCMOD and vQmod are NOT stand-alone plugins but depend on finding lines of code in a source file, making modifications and finally creating a cache file that the system uses instead of the original core file (kind of “Find/Replace” method but not within the core file). OCMOD cache files can be found in the system folder:
root_of_your_website/system/storage/modification/

OCMOD extensions are installed by using the default Extension Installer, and please bear in mind that vQmod and OCMOD xml files are NOT interchangeable, hence vQmod extensions cannot be installed using the Extension Installer and OCMOD extensions cannot be installed using vQmod.

extension-installer

Important thing to know is that if the core file code has been changed, or if another OCMOD/vQmod extension needs to modify the same line, then it is quite possible that the extension will not work!
If needed an OCMOD extension can be temporarily disabled or permanently deleted with no alterations or changes of any kind being made to the core files.

Installation of OCMOD extension or module is quite simple. Once you download the extension/module that you need (must be compatible with your version of OpenCart and must ends with .ocmod.zip) you upload that ZIP archive via Extension Installer, and click the Refresh button (very important step!) to reload the modification file.
The downloaded ZIP archive should contain a folder named upload which is required though it may be empty. So usually the file structure of OCMOD extension/module includes the following files and folder:

  • upload (required folder that may contain no files)
  • install.xml (required file that contains modification instructions)
  • install.sql (optional file)
  • install.php (optional file)

As you already know and probably have experienced so far every system has its ups and downs, so OCMOD has its known issues and errors. So if the searched line of code is not found and replace instruction is not being executed then a “NOT FOUND” error is logged and the modification is skipped or the whole extension gets aborted. Either way the extension or module gets fu**ed up! Error logs come in very handy for that matter and they can be found in Dashboard panel under ExtensionsModificationsLog

log-files

4 comments

Leave a Reply

  1. Alex · May 12, 2016

    Exactly what I needed, a quick insight of the fairly new OC feature. Many thanx.

    • janoshke · May 12, 2016

      You’re welcome. Glad it was of use 😉

  2. Guntis Endzelis · May 12

    Hi, I am trying to find out where the Opencart 3.0.1.2 keeps the modification cache files. I cannot find them in system/storage/modification. Anything changed with this version?

    • janoshke · May 12

      Hi,
      So far no changes to the modification folder is done, not to my knowledge at least. It is located as in previous 2.x versions in: system/storage/modification
      Upon clean install you will only see here the index.html file, but after installing extensions and plugins, which use OCmod, inside the modification folder other folders will appear as well (e.g. admin, catalog, system…) depending on the files that given extension is modifying.
      I hope this brings more light to your question.

      P.S. Also note that cache folder is a different folder located in system/storage/cache which is related to system cache files rather than extension modifications.