Four fact for Virtuemart :

  1. It's very promising, it build on top on Joomla MVC , it's not like other joomla shopping cart solution which using external apps into joomla cms.
  2. It's not out of the box solution, you'll have "the plain and default" which require a lot of customization.
  3. The core devs is damn lazy to build technical documentation (i hope they have active doc team someday), so all the details are scattered in the forum
  4. New Update sometime not backward compatible, yes, you're could break your site when you upgrade your virtuemart site (even its minor version, make sure you put attention to changelog)

The only reason why we still use virtuemart is because they're damn good !

So in this tutorial i hope i can briefly guide you to build an extension for virtuemart2 shipment plugin.

For this example, i will build a shipment plugin called JNE

Let's get started !

STEP 1. List me on dude !

 

The very first thing is to list your new shipment plugin in virtuemart system

  1. Create folder under vmshipment, name it as your shipment module (jne)
  2. Create at least 3 file: jne.xml , jne.php, index.html

The folder structure should look like this:

You don't have to worry about index.html, let it be a blank file for security purpose.

XML : The manifest (and configuration) file

For a quick course, i suggest you copy the manifest file that comes from the default weight_countries plugin. But if you want to dig deep into the details into each of configuration file you can visit joomla manifest file documentation

Just don't forget to set the plugin group into "vmshipment"

 PHP: Where the puzzle and magic begins

Now for your main plugin file, i suggest you copy the content form weight_countries as (i think) it had the list of working event that you can use. It's bit funny when i try to compare the event list on their wiki, and most of them are different. You can see the VM2's wiki here. Something is wrong with the wiki, it extend vmShipperPlugin when the one that comes from weight_countries is an extend from vmPSPlugin , but honestly don't follow their official WIKI, because i checked on VM 2.1.4 and there's no such thing as vmShipperPlugin. (Ah c'mon Virtuemart team, please close the wiki if it outdated, people like me get mislead !)

 

STEP 2. Discovery Time !

Now go to Extensions Manager > Discover, and click discover button. You should have this kind of screen:

Check and Install your new plugin

-----------------------------------

PLEASE ALWAYS REMEMBER (although i sometimes still forget it myself and make my head spinning because of this matter) !

ALL INSTALLED PLUGIN usually is TURN OFF by default. so you need to activate it in your plugin manager

----------------------------------

After that you can go to virtuemart's backend, go to SHOP > Shipment Methods, Add New.
You should have your new plugin listed

Plugin Configuration

 

 

STEP 3. Main Plugin Configuration

Next step is the Plugin Configuration which is set from the XML file (in my case: jne.xml), hope the below image explains you lots better: