Hi all, here is our solution of changing order format (example: from a54f11 to 12345678).
Enjoy
file: administrator/components/com_virtuemart/models/orders.php
row: about 980 there should be function generateOrderNumber()
Before return statement I did something like that:
$data = $this->md5HexToDec($data);
md5HexToDec() is new function and you can put this after generateOrderNumber(...) function:
private function md5HexToDec($hex_str)
{
$arr = str_split($hex_str, 4);
foreach ($arr as $grp) {
$dec[] = str_pad(hexdec($grp), 5, '0', STR_PAD_LEFT);
}
return implode('', $dec);
}
Result is:
value before the change: 26e108
value after the change: 5318500016
Is there a way to make this upgrade-safe? So, when a new version of VM comes out, I don't have to redo this modification?
I have now created such a plugin, which allows the shop owner to change the order number, order password and invoice number at will:
http://open-tools.net/virtuemart-2-extensions/40-vm2-ordernumber.html
The format is given as a text string, where [...] is understood as a variable and replaced by its value (e.g. [year] by the current year).
The running counter is indicated by #. The counter can be configured to be global (e.g. not reset each year/month/..) or a separate counter for each year/month/...
I hope you like the plugin and it does what you need. If you have any suggestions or further needs, just tell me: office@open-tools.net
That looks great, ebiznis.org! Will try it out on my test-environment.
Thanks.