Extensions for Advanced Ordernumbers for VM

We are currently on Vacation!

We are currently closed for vacation until Mai 12. During that time, you can order and download all our plugins in our webshop as usual. However, our support will be very limited and you have to expect longer response times in the forum as well as for email support! Sorry for the inconvenience!

Extensions for the Advanced Ordernumbers Plugin for VirtueMart

Extensions for the Advanced Ordernumbers plugin for VirtueMart. These plugins provide custom variables or custom post-processing to the numbers. At least version 2.1 (or 4.0.1 for post-processing functionality) of the Advanced Ordernumbers plugin is required.
Product Product Price
Template for Extension Plugins for the Advanced Ordernumbers Plugin for VirtueMart
Price : FREE
Checksum Extension Example for the Advanced Ordernumbers Plugin for VirtueMart
Price : FREE

All these plugins are "normal" Joomla plugins of plugin type "vmshopper" and need to be installed via the Joomla extension manager. Upon installation they should be automatically published by the installer and their functionality should be available in the Advanced Ordernumbers plugin for VirtueMart immediately.


Please note that the plugin feature was added only in version 2.1 (and extended in version 4.0.1) of the Advanced Ordernumbers plugins, so you need to have at least that version installed.


Template for Ordernumber Extensions Plugins

This is a template for developers who want to write their own plugins to extend the Advanced Ordernumbers for VirtueMart plugin. It can be installed, but does not provide any useful functionality, unless a programmer implements the corresponding functions.

Sometimes, order/invoice numbers have to depend on properties (e.g. custom field values, awocoupon discounts, etc.) that are not by default provided by this plugin. Starting with version 2.1, the Advanced Ordernumbers plugin can be extended with plugins of type "vmshopper". Such extensions can add new variables, modify existing variables or post-process the generated order/invoice number. 

The template available for download has the complete file and code structure, which you can use as a starting point for such a plugin. You will need to adjust the file names, the .xml file and the class names. 


There are two triggers in the plugin class that can be reimplemented to provide/modify variables and add new functions:

function onVmOrdernumberGetVariables(&$reps, $fmt, $nrtype, $details)

This trigger is called before the variables in the number format are inserted and can be used to either add custom variables or modify existing replacement variables. 

Function arguments
$reps Associative array of all defined variables available for use in the formats. This array can be modified by adding new variables or changing existing entries. The variable name (including the square brackets!) is used as the key, its value is the array value of the entry in the associative array.
$fmt The raw order/invoice number format to be used (before custom variable definitions/replacements are applied)
$nrtype The type of number to be generated (0=Order number, 1=Invoice number, 2=Customer number, 3=Order Password)
$details The Order / Invoice details (whole cart) or user information
Return value: None / Ignored


function onVmOrdernumberGetVariables(&$reps, $fmt, $nrtype, $details) {
// As an example add a variable [type] that contains the number type:
switch ($nrtype) {
case 0: $reps['[type]'] = "Order"; break;
case 1: $reps['[type]'] = "Invoice"; break;
case 2: $reps['[type]'] = "Customer"; break;
case 3: $reps['[type]'] = "OrderPassword"; break;

// Another example: set the ip address:
if (isset($details->ip_address)) $reps["[ipaddress]"] = $details->ip_address;

// You can also modify existing variables:
$reps['[second]'] = $reps['[second]'] + 15;

function onVmOrdernumberPostprocessNumber(&$number, $type, $order)

This trigger is called after the plugin has created the order/invoice/customer number and can be used to post-process the them (e.g. to add checksums or call external bookkeeping systems to store an invoice number).

Function arguments
$number The generated number. To modify the final number, simply assign a new value to this argument.
$type Type of number (possible values are "order_number", "order_password", "invoice_number" and "customer_number")
$order The whole order as a PHP object.
Return value: None / Ignored


function onVmOrdernumberPostprocessNumber(&$number, $type, $order) {
// Example: Append the length of the number to the number
if ($type=="order_number") {
$number .= $checksum;
// Example 2: Store the invoice number in an external bookkeeping system
if ($type=="invoice_number") {
// simply take $number and trigger a webservice call sending that value
// (and e.g. the order ID stored in the $order object) to the bookkeeping system

Checksum Plugin

This plugin post-processes the order number to append its length as a checksum. Typically, other types of checksum are desired, so you might need to modify the onVmOrdernumberPostprocessNumber function (see below for the API documentation).

This plugin has no configuration settings.


Demo Server

Support Forum


These plugins are licenced unter the GNU GPLv3.