Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Advanced Ordernumbers for VirtueMart

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!

×

Notice

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

TOPIC:

Sometimes generate strange numbers 21 Aug 2017 13:40 #1

  • source@easy.cz
  • source@easy.cz's Avatar Topic Author
Hello,

we have some problems with numbers of order = sometimes plugin generate strange numbers and we can't understand why it happened and how to fix that - please help us.

Current settings is in PrtScr below
Version Joomla 2.2.5, VM 2.0.20b, PHP 5.3.3-7+squeeze28

Thank you very much
web support Minion.cz
Attachments:

Sometimes generate strange numbers 24 Aug 2017 21:18 #2

Hello,
Whenever an order is assigned a number that already exists, VM by default appends the current date/time. This is exactly what you observe. As your order number format does not contain any counter, whenever a new order generates a four-digit random number that was already used, you would have two orders with the same order number, so VM appends the date.

There are several approaches to this issue:
1. Include a counter in the number format, e.g. [year2]#[randomDigit4]. Then whenever a random number is generated that was already used, the counter will increase to 2 for that random number and no duplicate number will be generated. The drawback is that this basically generates a new counter (which is basically just one database entry, so no big performance hit) for each order.

2. Use a longer random number, e.g. [year2][randomDigit10]. While this will not prevent duplicate numbers, the probability that two orders will get the same random number will be very low and the situation you observe should hardly ever happen.

Best regards,
Reinhold

PS: You might think that the apparent solution would be for the plugin to check whether the order number generated is already in use and simply try to generate a new number. The problem is that this might lead to infinite loops. Imagine a number format of "[year2][randomDigit2]". When the 101th order comes in, there is simply no free order number left, so whatever random number is generate, it will always be in use already.
  • Page:
  • 1