Mister Denial Posted March 31, 2014 Share Posted March 31, 2014 Hi everyone, so PS 1.6. introduces a random letters series as order reference instead of the incremental numbers system like I am used to in 1.4. - is there a way to change that, or configure how the order reference is generated? Because while I understand that this new reference system prevents customers from knowing how many orders a business really has, it also makes my own workflow and filing a lot more complicated. Thanks for your help and input! Dan Link to comment Share on other sites More sharing options...
tuk66 Posted April 2, 2014 Share Posted April 2, 2014 The reference is created in Order::generateReference() function. This feature is already contained in PrestaShop v1.5 and you can find various discussions and solutions on the forum. Link to comment Share on other sites More sharing options...
NemoPS Posted April 2, 2014 Share Posted April 2, 2014 Actually, orders still have an ID, along with the reference number Link to comment Share on other sites More sharing options...
tuk66 Posted April 2, 2014 Share Posted April 2, 2014 That is true but the reference is used at many places so to change one function is easier. Link to comment Share on other sites More sharing options...
Mister Denial Posted April 2, 2014 Author Share Posted April 2, 2014 Hi and thank you both for your replies! I am upgrading from 1.4 so this order number issue is new to me, and searching the 1.6 forum did not show any results (and I did not think of checking the 1.5 forums). @ tuk66 - I just watched the M4 PDF demo video, and it looks like it is possible to create two different PDF invoice templates, is that right? In that case I could create a template for internal use that shows the order number in addition to the reference, which would allow me to keep my current warehouse management and filing practices, and I could edit a separate invoice for the customer that only shows the order reference. @ Nemo - yes, but it is not clearly visible, and not on the printed invoice either. We usually refer internally to orders by the three last digits of the order number, and it's so much easier to tell the person packing the order "hey, you need to do this and that with order 456" rather than "can you look up order RGDJKELFRP"! ;-) 1 Link to comment Share on other sites More sharing options...
tuk66 Posted April 2, 2014 Share Posted April 2, 2014 @ tuk66 - I just watched the M4 PDF demo video, and it looks like it is possible to create two different PDF invoice templates, is that right? In that case I could create a template for internal use that shows the order number in addition to the reference, which would allow me to keep my current warehouse management and filing practices, and I could edit a separate invoice for the customer that only shows the order reference. Exactly! 1 Link to comment Share on other sites More sharing options...
vekia Posted April 2, 2014 Share Posted April 2, 2014 check this topic: http://www.prestashop.com/forums/topic/218257-module-change-order-reference-using-order-id-andor-cart-id/ compability with 1.5.x means that it should work with 1.6.x too (i hope so!) 1 Link to comment Share on other sites More sharing options...
applecart_girl Posted June 26, 2014 Share Posted June 26, 2014 @vekia - sadly I just upgraded my store from 1.4.7.0 to 1.6.0.7 and this module doesn't work I'm afraid.Anyone else know how this can be changed? I'm with @Mr Denial ... it's much easier to look up an order with numbers in order rather than random letters - argh !!! 1 Link to comment Share on other sites More sharing options...
Chrisoo Posted October 16, 2014 Share Posted October 16, 2014 With me on Prestashop 1.6.0.9 did not work Link to comment Share on other sites More sharing options...
pepanek99 Posted November 12, 2014 Share Posted November 12, 2014 @vekia - sadly I just upgraded my store from 1.4.7.0 to 1.6.0.7 and this module doesn't work I'm afraid. Anyone else know how this can be changed? I'm with @Mr Denial ... it's much easier to look up an order with numbers in order rather than random letters - argh !!! Hi, actually it`s pretty easy. If you want order number to be generated from numbers (for example 943751684) and not from letters (GFKELCTRY), 1. Open the file /classes/order/Order.php 2. Find the function generateReference() (row 1497 in version 1.6.0.9, for example) 3. Two rows below change the parameter 'NO_NUMERIC' to 'NUMERIC' 4. Optionaly change the number '9' to different one (it defines the length of order ID) The whole row should looks like: return strtoupper(Tools::passwdGen(9, 'NUMERIC')); This calls the function passwdGen that you can find in /classes/Tools.php, if you want to play more with algorithm how the order ID is generated. PS: I`m not programmer and I have only basic knowledge of PHP. I`m using Prestashop for 1 month only. Still it`s possible to dive inside the Prestashop code and find the way how to change the behavior. 6 Link to comment Share on other sites More sharing options...
__fito__ Posted November 28, 2014 Share Posted November 28, 2014 Many thanks pepanek99, it works like a charm! Link to comment Share on other sites More sharing options...
paleoglobe Posted December 8, 2014 Share Posted December 8, 2014 (edited) i have more than one shop and the system (numerical or not) does not allow me to see difference between orders on different shops. when a payment comes in, i don't see straight away on my bank account which shop has generated a paid sale. Is it possible to have a reference like this? Shop1-5689 Shop2-6985 Or completely numerical where the first number is the number of the shop: 15689 26985 So i would need a fixed first part followed with the reference of this order. I hope this is possible... thanks Christophe Edited December 8, 2014 by paleoglobe (see edit history) Link to comment Share on other sites More sharing options...
pepanek99 Posted December 8, 2014 Share Posted December 8, 2014 i have more than one shop and the system (numerical or not) does not allow me to see difference between orders on different shops. when a payment comes in, i don't see straight away on my bank account which shop has generated a paid sale. Is it possible to have a reference like this? Shop1-5689 Shop2-6985 Or completely numerical where the first number is the number of the shop: 15689 26985 So i would need a fixed first part followed with the reference of this order. I hope this is possible... thanks Christophe Both are possible. Just play with the function generateReference() as I described. Link to comment Share on other sites More sharing options...
paleoglobe Posted December 9, 2014 Share Posted December 9, 2014 and what code exactly should i use to make this 'shop 1' prefix? Link to comment Share on other sites More sharing options...
NemoPS Posted December 9, 2014 Share Posted December 9, 2014 try with public static function generateReference() { return strtoupper('Shop' . Context::getContext()->shop->id . '-'.Tools::passwdGen(9, 'NO_NUMERIC')); } 1 Link to comment Share on other sites More sharing options...
kayol10 Posted December 27, 2014 Share Posted December 27, 2014 Excellent @ pepanek99, Thanks! Link to comment Share on other sites More sharing options...
wmh90 Posted January 23, 2015 Share Posted January 23, 2015 Tried here and not working, even with that module. The best I can do is random numbers changing the NO_NUMBERS to NUMBERS on class. Any help on this, please? Just left this to put my store online. Link to comment Share on other sites More sharing options...
NemoPS Posted January 24, 2015 Share Posted January 24, 2015 @wmh90: do you need all a-z chars without numbers? Link to comment Share on other sites More sharing options...
wmh90 Posted January 24, 2015 Share Posted January 24, 2015 I need sequential numbers, like: 0001, 0002... Now I can get random letters or numbers, but I need it sequentially. I followed all the methods and non worked for me, even the module. I'm on PS 1.6.0.11 Thanks for your help. Link to comment Share on other sites More sharing options...
Brian.abk Posted January 25, 2015 Share Posted January 25, 2015 (edited) I need sequential numbers, like: 0001, 0002... Now I can get random letters or numbers, but I need it sequentially. I followed all the methods and non worked for me, even the module. I'm on PS 1.6.0.11 Thanks for your help. I also need reference is the same as the invoice number, so I want to know where to change it.. thanks Edited January 25, 2015 by Brian.abk (see edit history) 2 Link to comment Share on other sites More sharing options...
wmh90 Posted January 25, 2015 Share Posted January 25, 2015 I also need reference is the same as the invoice number, so I want to know where to change it.. thanks Same here. It's the best way. Link to comment Share on other sites More sharing options...
NemoPS Posted January 26, 2015 Share Posted January 26, 2015 The only way to have sequential numbers is to 1- On that method, grab the highest ref number from the db (let's pretend we have it, if not it's 00001) 2- Extract the integer from that string, then increment by 1, use lpad to add 0s and save it to the reference field Link to comment Share on other sites More sharing options...
Recommended Posts