Advanced Ordernumbers for VirtueMart FAQ
1) Which PHP, Joomla and VirtueMart versions does the plugin work with?
I am developing the plugin with PHP 5.4 and 5.5 on Joomla 2.5 with VirtueMart 2.x. Starting with plugin version 1.9, support for Joomla 3.x and VirtueMart 3.x was added. Support for VirtueMart 2.x on Joomla 1.5 is available only up to plugin version 1.8.2. If you need that version, please contact us, as old versions are not available for download by default.
In version 1.3 I fixed some problems with php 5.2, and I have not heard of any problems with php 5.2 since (those with problems confirmed that their problems no longer appear).
Other combinations might work, but I have not had any reports. If you are using the plugin on a different combination of versions, please let me know whether it works or not.
2) DEPRECATED: How can I let the order/invoice/customer numbers start from a given value rather than from 1.
Until version 2.0 of the plugin there was no way to set the counter to some particular value in the Joomla/VirtueMart backend (mainly due to the fact that in the plugin configuration screen I had no easy access to the databases, and also had no way to execute some code to read/modify the database entries). In version 2.0, support for changing the counters was added directly in the plugin configuration screen, so the method described in this section is no longer needed.
In previous version, it was, however, possible to change the counter entry manually in the MySQL database. In particular, in the mysql database the counters are stored in a table called (prefix)_virtuemart_shopper_plg_ordernumber, where (prefix) depends on your installation, sometimes it's jml, sometimes jos, or something entirely different. That table will be created on the fly when the first order is processed by the plugin, so you might make a test order directly after installation.
-) The number_type column means: 0=orderNr, 1=invoiceNr, 2=customerNr
-) The number_format gives the value of the format.
-) The count is the current count for the given format. The value in the database is the previously used number, so the next order/invoice will be incremented by 1.
E.g. if you have only a running counter (format "#"), then you would change the count column of the database entry with a number_format of # to the current value of your invoices.
If you use a format of e.g. "[year][month]-#", then you would change the count column of the entry where number_format="201211-#".
If you use a global counter, the number_format column of the corresponding type will be empty.
3) Can I reset the invoice number after some test orders?
See the answer above to set the counter. Notice however, some caveats:
- Make sure you have deleted your test orders in VirtueMart. If VirtueMart encounters a new order/invoice with a number already existing, it will not replace that existing order, but rather modify the order/invoice number by appending the current date/time.
- Make sure to delete the already created invoices from the database (table jos_virtuemart_invoices). If VirtueMart encounters an invoice number, which is already present in the database, it will append the current date/time and thus create ugly invoice numbers.
- Also make sure you have deleted the PDF invoices on disk for you test orders. If VirtueMart encounters an invoice number, for which it finds a PDF invoice file on disk, it will NOT re-create the mailed pdf, but simply use the file found on disk.
4) Are there any incompatibilities known?
- The plugin DOES work together with VMInvoice by ARTIO. However, it might appear not to, because VMInvoice calls the order number the order ID. Once you keep that in mind, everything works.
- Some payment plugins (e.g. iDEAL) do not work with order numbers that contain spaces. Simply do not use spaces in the formats when you use one of those payment plugins, and the plugin will work fine. The iDEAL payment method is even stricter: Only order numbers containing letters and digits (but no - or _ or / or spaces) are allowed.
- Order numbers that contain a slash "/" do not properly work with joomla's SEF URLs. Ordering and invoicing works fine, but the links to the order details page contains a slash that confuses the SEF router. Similarly, if you do not use SEF, an ampersand (&) will confuse VirtueMart.
- There were some small bugs in older VirtueMart versions:
- Prior to VirtueMart 2.0.16, the filename for the PDF invoice was created directly from the invoice number. If the invoice number contains characters not allowed in a filename (like : or /), VirtueMart will be unable to create the PDF invoice and print an error.
- Customizing customer numbers does NOT work before VirtueMart 2.0.15b, because the callback function used by the plugin did not allow modifying the user data before version 2.0.15b. If you really need it working with a prior version, simply send me a mail.
5) Can I set the order number to the order ID?
Unfortunately, it is not possible to use an order number format of the form [orderID], because the order ID is only created when a new order is stored in the database. The order number, on the other hand, is created before that moment.
6) Can I reset the VirtueMart Order ID (not the order number!) to start from 1 again after some tests?
The order ID is automatically created by VirtueMart (even before my plugin comes into play). It is the auto-incrementing index `virtuemart_order_id
` in the jml_virtuemart_orders table. To reset it, you need to reset that auto-incrementing index directly in MySQL. As the order ID is not meant to be used publicly, but rather as an internal ID to ensure orders are unique, I will not give any recipe here how to tamper with that part of the VirtueMart internals. If you really know what you are doing, you should be able to find out yourself how to reset a table index in MySQL. Otherwise it is better to not touch the VirtueMart ID generation and simply modify the order and invoice numbers, as these are the number that are actually displayed to and used by your customers.
7) Special issues with the ordernumber plugin and the iDEAL payment method
- The iDEAL payment method does not work if the order number contains SPACES!
- Similarly, an order number that contains - (or any character other than letters and digits!), the iDEAL payment server will return an error and the payment will fail.
The only solution is to use an order number format that only contains letters and digits, but no other characters like -, /, etc.
8) Can you please implement [...]?
I'm always open for good suggestions and ideas concerning the plugin's functionality. However, as my time is really limited, I cannot promise anything. Currently, the following ideas are on my list:
- Allow [country] to insert two-letter country codes to invoice and customer numbers (implemented in version 1.7)
- Add a way to configure the PDF invoice file name (needs support in VirtueMart core code first)
- Add a way to use only the first n letters of e.g. the surname
- Add an advanced option to have a different counter format value for reset than for the order/invoice number (e.g. to have a format 2014-05-03/076, but have the counter only reset yearly) (implemented in version 1.12)
- Try to figure out a way to change/reset the counter directly in the plugin config (implemented in version 2.0)
I have no idea when I will be able to implement these ideas. If you really need any feature urgently, please feel free to ask me for a quote for custom development. All commissioned features will of course be made available to all other plugin users, too, if they are useful to the general public.
9) How can I change the order and invoice numbers of existing orders?
The short answer: You can't! This plugin can only modify the order and invoice numbers of new orders.
The long answer: There is no graphical interface for changing order/invoice/customer numbers in the Virtuemart backend. However, if you really know what you are doing, you can modify the database directly. Notice, however, that the order numbers and invoice numbers have already been sent out to your customers, so we don't recommend changing existing orders....