benyben Posted June 11, 2015 Share Posted June 11, 2015 First:In PrestaShop 1.6 (tested and confirmed working in v1.6.0.14) you can accomplish this by the following method. Copy the file /classes/PaymentModule.php to /override/classes/PaymentModule.php. Edit the file /override/classes/PaymentModule.php as follows.At lines 337-341 is a code block that should read like this:if (!result){ PrestaShopLogger::addLog('PaymentModule::validateOrder - Order cannot be created', 3, null, 'Cart', (int)$id_cart, true); throw new PrestaShopException('Can\'t save Order');}Immediately after that code block, insert the following two lines of code:$order->reference = str_pad($order->id, 9, '0', STR_PAD_LEFT);$order->update(); Delete the file /cache/class_index.php so that Prestashop automatically re-creates this file taking into account the new override file.note: if you want to start from 3456 (put 5 not 9 )here-> id, 9, '0', STR_PAD_LEFT);so, is gona be id order 03456 ( not 000003456)Second:Ive made a plugin for the backend for this. To use it:1. Copy the attached file into your admin/tabs folder2. Go to Administration/ Menus /Add New3. Enter "Order Options" as the name4. Enter "AdminOrderOptions" as the class5. Select "Orders" as the parent6. Click Save7. Go to Orders/Order Options8. Enter the new number you want to start with9. Click "Change Start number"It is not my merit, I only joined two pieces of information found on this forum! AdminOrderOptions.php 2 Link to comment Share on other sites More sharing options...
pishkus Posted June 11, 2015 Share Posted June 11, 2015 Is this somewhat similar to this module? https://www.prestashop.com/forums/topic/218257-module-change-order-reference-using-order-id-andor-cart-id/ Link to comment Share on other sites More sharing options...
benyben Posted June 11, 2015 Author Share Posted June 11, 2015 (edited) I had trouble with that module, see picture, marked by red.the method above, marked by blue.I went to prestashop after ZenCart, and had orders 18k not consecutive numbers because I just made this change and we wiped the test orders Edited June 11, 2015 by benyben (see edit history) 1 Link to comment Share on other sites More sharing options...
ajensen27 Posted October 19, 2015 Share Posted October 19, 2015 This worked PERFECTLY... Thanks!! I'm on PS vs 1.6.1.1 Link to comment Share on other sites More sharing options...
KarZan Posted October 25, 2015 Share Posted October 25, 2015 (edited) This did not work for me. I have 1.6.0.14 but I need to update because of certain error messages on admin due to hosting server settings. Anyway I made a copy of my shop to test upgrading to 1.6.1.1. The problem is that the module does not seem to work with 1.6.1.1 and thus I uninstalled the module and tried this approach. But even with this modification the reference is still letters. I did the oerride file and modified it as per instructions and then deleted the class cache file. Sill letters as a reference??? Changing of the order id works though Any pointers? Edited October 25, 2015 by KarZan (see edit history) Link to comment Share on other sites More sharing options...
KarZan Posted October 25, 2015 Share Posted October 25, 2015 This did not work for me. I have 1.6.0.14 but I need to update because of certain error messages on admin due to hosting server settings. Anyway I made a copy of my shop to test upgrading to 1.6.1.1. The problem is that the module does not seem to work with 1.6.1.1 and thus I uninstalled the module and tried this approach. But even with this modification the reference is still letters. I did the oerride file and modified it as per instructions and then deleted the class cache file. Sill letters as a reference??? Changing of the order id works though Any pointers? Actually as soon as I had posted this I I found this https://www.prestashop.com/forums/topic/433999-free-module-order-reference-change-module/page-3?hl=%2Bchange+%2Border+%2Breference&do=findComment&comment=2169299 So I ones more made sure the module was removed AND I also made sure the PaymentModule.php in the overrides/classes was "empty" <?php abstract class PaymentModule extends PaymentModuleCore { Then I reinstalled the module and went through it's setup. After that all was working again as in the previus version Link to comment Share on other sites More sharing options...
zod Posted December 6, 2015 Share Posted December 6, 2015 (edited) I tryed the module "change order reference" version 1.5.5.1 but it was not working for payments through PayPal. So I followed an easier override method, in the Order.php class, for me it is working in PS 1.6.1.2.Instructions by NemoPS: http://nemops.com/prestashop-replace-order-references-with-ids/#.VmPx-HshlXnJust pay attention to the generation of class_index.php, and check if all your overrides are running, and how.In my case i had to delete manually the 3 overrides the module ChangeRef created, because uninstalling it, they were not deleted: override/classes/order/Order.php override/classes/order/OrderInvoice.php override/classes/order/OrderPayment.php After that, i put my Order.php by NemoPS, generated my class_index.php and at first it had NO overrides (not sure why), so it seemed not working. No worry, i generated it again, overrides were all up and running, and now it is working. Edited December 6, 2015 by zod (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now