Pros and cons of using vQmod in OpenCart

What is a vQmod?

vQmod (virtual file modification system) is a powerful system designed to help developers when they have to edit system core files. The vQmod, by it’s nature, help you alter source files without actually editing them. All changes are saved in a temporary file which is substituted for the original during execution.

In this blog post I will try to reveal what are the good and the bad things about using vQmod.

Pros

No actual changes in the code are made. As I said earlier, all changes are saved in temporary files. That means that there is no chance for you to mess up the core files of your website.

Simple structured XML format. You have to make your modifications in a XML file, which after that creates a temp file. That temp file is then executed instead of the actual file. Basic programming skills will be enough for you to make the changes you need. Here’s an example of simple XML replace script:


<?xml version="1.0" encoding="UTF-8"?>
<modification>
       <id>Replace Hello World! with Hello iSenseLabs!</id>
       <version>1.0</version>
       <vqmver>2.4.0</vqmver>
       <author>iSenseLabs.com</author>
       
       <file name="relative_path/file.php">
               <operation>
               
                       <search position="replace"><![CDATA[
                       $var = 'Hello World!';
                       ]]></search>
                       
                       <add><![CDATA[
                       $var = 'Hello iSenseLabs!';
                       ]]></add>
                       
               </operation>
       </file> 
</modification>

As you can see, this script simply changes the value of a variable in the file “file.php” from “Hello World!” to “Hello iSenseLabs!” before it gets included.

vQmod will not slow down your site. You shouldn’t be concerned about loading speeds. According to the creators of the module, the overall impact to the site won’t be noticeable and we can confirm that. In our work we were coming across websites that are using more than 20 XML scripts. Still, they were loading pretty fast.

Upgrade is hassle-free and safe . Why? Because the core files are not edited. The only thing you need to do after that is to check if the XML scripts needs changes to make them work with the new files.

Super easy for troubleshooting. There are log files and you can easily find the source of the problem.

Remove in one click. If you want to remove vQmod modifications, you just have to delete the XML script. It’s simple as that.

Cons

Incompatibility. You should be very careful with the modifications you make. If you use two XML files to modify one same line from a core file, that will surely cause a problem.

File limitations. There are some files that you cannot edit with XML modifications. You are not allowed to change index.php because this is where vQmod loads. Of course, you can edit index.php, you just cannot use XML scripts.

You can't edit everything - CSS, JS and standalone files. Stylesheets and JavaScripts are handled by the browser, so you cannot edit them via a vQmod by default. Nevertheless, there is a way to do this. You can use inline CSS or JavaScript code for your needs.

Unfortunately, standalone files which don’t have vQmod included are also not affected by XML modifications and regretfully there is nothing we can do about them.

In conclusion

If you or your developer are creating modules for your store and there are things that cannot be done with the default store functionality, then vQmod is a great tool to make things come into play. It’s fast, easy to use and you keep the core files intact. Version compatibility is also a big plus, so with the new versions of OpenCart coming out, you will be able to upgrade without losing your modifications or doing them over again.

 

Join 11,000+ subscribers receiving actionable E-commerce advice

* Unsubscribe any time

Trending blogs

comments powered by Disqus