I think the question was to modify the order no. generation scheme. I worked out a little something on that.
To change the order number generation do as follows:
1) Go to administrator/components/com_virtuemart/classes/ps_checkout.php
Find the following function - get_order_number()
and edit global $auth;
/* Generated a unique order number */
$str = session_id();
$str .= (string)time();
$order_number = $auth['user_id'] .'_'. md5($str);
return substr($order_number, 0, 32);
as follows global $auth;
/* Generated a unique order number */
$str = session_id();
$str .= (string)time();
$checksum = crc32($str);
$date = date('Y-m-d');
$order_number = $date . $checksum;
return substr($order_number, 0, 19);
This will give you an order number of the format YYYY-MM-DD-RANDNUMBR This gives us an order number, which is quite reasonably formatted and the uniqueness is still maintained.
Now, the order number should go like this and should be displayed in the account maintenance.
2) Go to administrator/components/com_virtuemart/classes/ps_order.php
at line 308 change $q = "SELECT first_name,last_name,user_email,order_status_name FROM #__{vm}_order_user_info,#__{vm}_orders,#__{vm}_order_status ";
to $q = "SELECT first_name,last_name,order_number,user_email,order_status_name FROM #__{vm}_order_user_info,#__{vm}_orders,#__{vm}_order_status ";
at line 340 and 343, change $d["order_id"]
to $d["order_number"]
This ensures that the user gets e-mailed about his order number, instead of order_id.
Now, in the account maintenance panel, displaying the order_number instead of the id is something I've not been able get to correctly work out, so if someone could get that working, this would be complete
EDIT: Was able to complete the whole job
3) In the same file, (administrator/components/com_virtuemart/classes/ps_order.php) at line 615 or find the code $tmp_cell .= "<br /><strong>".$VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').":</strong> " . sprintf("%08d", $db->f("order_id"));
and change it to
$tmp_cell .= "<br /><strong>".$VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').":</strong> " . sprintf($db->f("order_number"));
and at line 559 change $listfields = 'cdate,order_total,order_status,order_id,order_number,order_currency';
to $listfields = 'cdate,order_total,order_status,order_id,order_currency';
4) Now, go to administrator/components/com_virtuemart/html/account.order_details.php and change the code
$mainframe->setPageTitle( $VM_LANG->_('PHPSHOP_ACC_ORDER_INFO').' : '.$VM_LANG->_('PHPSHOP_ORDER_LIST_ID').' '.$db->f('order_id'));
to
$mainframe->setPageTitle( $VM_LANG->_('PHPSHOP_ACC_ORDER_INFO').' : '.$VM_LANG->_('PHPSHOP_ORDER_LIST_ID').' '.$db->f('order_number'));
5) finally, go to components/com_virtuemart/themes/default/templates/pages/account.order_details.tpl.php
and change <td><?php printf("%08d", $db->f("order_id")); ?></td>
to <td><?php printf($db->f("order_number")); ?></td>
As far as I have tested, this does not break anything and it very simple to implement. That said, it is a hack, and maybe someone should identify the changes that are to be made and integrate into the system as a changeable option. (ofcourse, the order_number generation is something that can be custom, but still...)
Hope this helps a lot of people. And maybe mods can sticky it ?