The above solutions are essentially correct, but you REALLY have to refrain from changing any kernel code if you can save it. I put all my mods in a special folder locally after I applied any updates to preashashop or my theme engine, after which I upload the changes one by one (after each test).
These instructions are for 1.6.x users, but MAY work on 1.5.x. I do not have this code for testing.
1) Create a file called order.php and put the code below in this file
2) Then upload the file to /override/classes/order/order.php
3) Go to the / cache folder and delete the class_index.php file (it will be recreated on the next page request)
<?php Class Order extends OrderCore { public static function generateReference() { $last_id = Db::getInstance()->getValue('SELECT MAX(id_order) FROM '._DB_PREFIX_.'orders'); return str_pad((int)$last_id + 1, 9, 'NR-000000', STR_PAD_LEFT); } }
You should now be finished, and your next order will have a link to something like: NR-000101
The second "OPTION" in the code comments returns the reference order number, essentially for PS 1.5.x - (I had a link to it in the old file.)
I also included the appropriate SQL statement in the code comments to set the next order number, if necessary.
Obewan
source share