IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!



The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1


Separate counter per format value? 13 Mar 2014 20:20 #1

  • stiponline
  • stiponline's Avatar Topic Author
If I use [year][month]# what will the effect be of the option "Separate counter per format value". Reset the counter at 1 at the beginning of the new month or by the beginning of the new year?
I hope by the beginning of a new year!

Separate counter per format value? 13 Mar 2014 22:54 #2

It's actually a bit more complicated: The plugin does not have one counter, that is reset at the beginning of a new year/month.
Rather is has multiple concurrent counters. When generating the order number, the plugin will first replace all [...] parts with the variable values. Then it will look if for the resulting string a counter already exists, increase the value by 1 and insert that counter value instead of the #.

Let's look at an example in your case:
-) First order (On March 3):
"[year][month]#" will first be replaced to "201403#". Then the plugin will look into the database whether a counter named "201403#" already exists. It does not yet, so the plugin will use a counter value of 1 and insert that (and will store the value of the "201403#" counter into the database). Thus the result will be "2014031".

-) Another order (on march 25):
"[year][month]#" will first be replaced to "201403#". This time, a counter named "201403#" already exists (with value 1), so the new value will be 2 and is inserted into the format to yield "2014032"

-) Another order (on april 1):
"[year][month#" will now be replaced to "201404#". There is not yet such a counter, so a value of 1 will be used, which leads to "2014041".

So, in effect it appears as if the counter is reset at the beginning of each month in your case, while in fact a new counter is used for each month. In your case that might not seem to make a difference.

However, this approach has the advantage that you can have e.g. different counters for orders to different countries. If you use the format "[year]-[countrycode2]-#", each country will have its own counter and you have order numbers like "2014-AT-1", "2014-DE-1", "2014-AT-2", "2014-AT-3", "2014-CH-1", "2014-DE-2", etc. (Notice that the orders for AT have one counter, while the DE have another independent countet).

This approach is very generic (and very simple, yet really powerful), but unfortunately it also means that having a format of "[year][month]#" where the counter is reset only each year is NOT possible, since the format value will change each month and the format value will be used as the counter name...

Best regards,

[SOLVED] Separate counter per format value? 04 Jun 2014 11:34 #3

Problem solved.
  • Page:
  • 1