Opencart and vQmod, wtf?

So I recently had the opportunity to work on a site built on the Opencart open source e-commerce system. Coming from a site that was custom built with the Zend Framework I was initially pleased with the simplicity of the code. It was fairly obvious how things were put together and there was none of that object oriented madness that frustrates new developers. Then I discovered vQmod. After a day or so with it I was shouting wtf’s at a regular pace. Needless to say, I quit the job shortly thereafter.

Here is the problem. First, you start off with a simple easy to use pre-made site. Anyone with 6 months coding experience can get it installed and set up, yay! the bosses are happy with your amazing progress. Then your boss says, ‘Hey can you add XYZ functionality to the site?’. So you immediately look and see if someone else has already implemented XYZ and wholla! they have. there is a plugin that uses vQmod! YAY we are all happy!

Then your boss asks you for another feature, and another… pretty soon you say, ‘hey look, here is a site with all of the plugins we can add’. Bad Idea! your boss wants all of them but you have no idea what this means for your code because you don’t understand how vQmod works.

vQmod seems like a good idea at first. What it does is simple, whenever a third party developer wants to create a plugin they often have to make changes to the core code. Making changes to the core code is a bad thing because it makes it impossible to upgrade the core code later on. So what vQmod does is looks for the part of the core code that you want to change and essentially does a search and replace with the changes that you want. It then creates a new file which is used instead of your core code file so your core code never actually changes.

This works great when you have one plugin, but as soon as you add more than one you increase the risk of one plugin’s changes stomping all over another plugins changes. The thing your boss doesn’t realize is that these plugin developers don’t bother to test their changes against all the other plugins. In fact it’s practically impossible for them to do this because every time you add a new plugin you increase the possible combinations of plugins that they have to test.

Now as you go on adding more and more plugins you start to see more and more bugs, but you boss has gotten used to the quick fix of adding features practically overnight. This is not going to end well.

In the end, my suggestion was that the entire site should be scrapped and a new one built from the ground up correctly. Object oriented methods may appear to be unnecessary to the naive, but it is exactly those methods which prevents things like this from getting out of hand.

So in conclusion, my opinion of opencart is that its a great tool, if you happen to want exactly what it offers and not much more. If you actually want specific functionality then don’t waste your time. And its important to note that this is not a problem just with opencart, you have similar problems with all the other site-in-a-box solutions (ie gocart, oscommerce, drupal etc..).

There is also the flipside with products like Magento, which really are built correctly, however the problem with these is that they try to solve all problems at once. What you end up with is an extremely complicated code base that is difficult to maintain/learn. In the end there is nothing better (IMO) than building a site from scratch (or use a framework like Zend/CodeIgnitor/Symfony) and build it explicitly with the features you want.

Posted Sunday, October 6th, 2013 under Code, Rants.

Leave a Reply