Despite being only a single shopping cart component within the larger Joomla framework, Virtuemart is a vast and complicated system in its own right. It is in many ways almost as large and complicated as Joomla itself with about 1500 files between the front and back-ends, as well as its own completely self-contained module and templating systems. I'll be covering Virtuemart in a number of future posts but here are a few quick tips to get started.

Three quick tips on Virtuemart customization

If your goal is to add custom functionality to your Virtuemart shopping cart system, even just figuring out where to start can be a daunting affair. Ideally, you want to be able add your functionality to Virtuemart in a way that meets the following criteria:

It is as self-contained as possible

What are you going to do if you want to upgrade to a newer version of Virtuemart? Sure you can just find the files that run whatever part of the store you are trying to modify and hack around until they do what you need to do, but in the long run, this type of approach will just end up making your life more difficult. For one thing, its not portable. What are you going to do if your customer wants to upgrade to a newer version of Virtuemart? Manually diff each affected file and re-insert your changes by hand? Not only would that be time-consuming, tedious, and error-prone, it also might not even work if there are significant changes between the old and new versions of the files you modified, so you'll spend even more time re-thinking problems you've already solved. Also, with this approach you will more than likely end up with your code spread across multiple locations in multiple files, which can make things very difficult to debug when errors start happening (and they will!).

It is easy to install and uninstall

This is really an extension of the previous point, but it is an important one. In fact, this criterion should be a no-brainer, especially if the store website is being set up by someone other than yourself.

Pointer: Keep in mind that with any project, you are usually not coding just for yourself and just for one function. You need to consider your clients, subsequent developers, administrators, and tons of other factors right from the beginning.

Which do you think a site administrator is less likely to screw up: a) copying and pasting changes at specific locations within half a dozen files or b) running a script that automatically copies a single file to a certain directory and modifies a database entry to point to it. If you answered a, you are either a robot or you weren't reading the question.

It runs within Virtuemart

You want your code to interact seamlessly with Virtuemart. This is not always a 100% crucial criterion to meet, but if you can find a way to do this, it will make your life much easier. "It runs within Virtuemart" means that your code will be run in the same context as all of the other Virtuemart code. This is useful because it gives you easy access to all the existing Virtuemart data, modules, classes, and functions. You want your code to be called from Virtuemart itself in such a way that it can interact seamlessly with the rest of Virtuemart as if it were part of the core code itself. If this is done well, your customizations will seem more like features that have always been there instead of custom modifications that were just added on.

Doctor's Orders

Now that you know what characteristics your custom component should have, the next step is to figure out how to actually get Virtuemart to run it. Tune in next time to learn two new and exciting ways to do this! If you have no idea what Virtuemart is, check out the main site for more information. It is by far the most comprehensive shopping cart for Joomla websites.


Like this? Tweet it to your followers!
Tagged undervirtuemartecommerce

Latest articles from Jom Doctor S.

Latest 'tweets' from JomDoc.com

  • Do you use SEF URLs with your Joomla site? Check out this very important post on how do save time in the long run: http://bit.ly/6nvSfv Link Wednesday, 25 November 2009 21:23
  • New Blog: Selecting a Professional Joomla Theme http://tinyurl.com/ykokson Link Monday, 16 November 2009 23:58
  • Cloning a Joomla site for development - not that hard. See the tutorial on JomDoc.com: http://tinyurl.com/yfdzzqh Link Sunday, 15 November 2009 19:28
  • Virtuemart + authorize.net customer information manager = secure customer data storage Link Monday, 09 November 2009 21:02
  • Looking forward to some improvements on the company site. Link Saturday, 07 November 2009 23:17
blog comments powered by Disqus

Getting by with a little help from our friends...

The Doctor recommends Rockettheme if you want a powerful and adaptable Joomla template