How to Use Opencart’s vQmod

Opencart for a long time was needing a way to easily patch code into the framework whereby being able to remove it later without disrupting the integrity of the overall structure; In short, a plugin-like system that allowed users to easily plugin/unplug extensions to in their website without much hassle. For the longest time all extensions sold in the shop were core edits and if the files included in the package were not brand new then it would overwrite your existing code. This just isn’t realistic for a number of obvious reasons the biggest one being that you shouldn’t have to disrupt your website structure just to plug in an extension. Introducing VQMOD! Vqmod is pretty much an Opencart standard at the moment and is being used by just about everyone especially developers like myself.

VQMOD

Description:

“vQmod™” (aka 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. There are however limitations to vQmod such as

-no patching of javascript files (included files)

-poor debugging within the Opencart error logs (the line number is never accurate)

Here is a basic vqMod set up:

<modification>
         <id>My Vq Mod Title</id>
         <version>1.4.x and 1.5.x</version>
         <vqmver>1.0.8</vqmver>
         <author>You the author</author>     
         <file name=”catalog/controller/product/category.php”>
      <operation>
                        <search position=”after”><![CDATA[
                public function index() {
            ]]>    
                        </search>
                        <add><![CDATA[ $variable = false;

]]></add>
              </operation>
          </file>    
             
</modification>

All this is doing is SEARCHING for a line and sticking our variable in the code directly AFTER that line.

If you are not a developer and only a user then all you will be doing is installing the vqMOD so you can use it.

To install the vqMOD

  •  Go here  and download the version for opencart.
  • Unzip it and upload the contents to your store install location. Now go to www.yourdomain.com/vqmod/install and run the installer. DONE!

Now you will be able to use all extensions that require vqMod.

NOTE TO DEVELOPERS:

Always attempt to use parts of code that are likely to be UNCHANGED during major upgrades or newer versions of Opencart. This way you will not have to go through a lot of hassle in updating. Sometimes even using version checks a good way to set up needed conditionals for versions that are older compared to newer.

Looking for quality OpenCart Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , | Posted under OpenCart | RSS 2.0

Author Spotlight

Joe Stenhouse

Joe Stenhouse

I am a web application developer that specializes in PHP, JAVASCRIPT, MYSQL, HTML, and CSS. We manifest exciting potentials within the world wide web through means of innovation.

Leave a Reply

Your email address will not be published. Required fields are marked *


6 × = 48

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>