Page 2 of 2
Re: How to change order_id for Invoice number
Posted: Wed Sep 29, 2010 2:02 pm
by yiyinlah
dramony wrote:go to you phpmyadmin, click
SQL (located on the top) then paste this on the text area:
Code: Select all
ALTER TABLE `order` AUTO_INCREMENT =10000
Click the
Go button on the right side.
Hi!
THank you, but it doesn't exist.
I tried & this is what it prompt me,
"#1146 - Table 'username_opcart.order' doesn't exist"
I don't know what to do anymore.
What had happened? Do it really not exist?
Please help me!
Thank you very much!
`
`
`
Re: How to change order_id for Invoice number
Posted: Wed Sep 29, 2010 2:05 pm
by yiyinlah
Hi!
Thank you all!
I solved it!
I had forgotten about those prefixes.
I had changed & successfully made it worked!
Thank you so much!!!
`
Re: How to change order_id for Invoice number
Posted: Wed Nov 17, 2010 4:24 am
by JasonC
Qphoria wrote:Execute this simple sql in your phpmyadmin
Code: Select all
ALTER TABLE `order` AUTO_INCREMENT =10000
(prepend a prefix if needed (i.e. `xxx_order`)
Now it will start at 10000
What is the correct syntax to add the prefix?
thanks
Re: How to change order_id for Invoice number error #1046 -
Posted: Mon Dec 06, 2010 10:27 am
by Blackbet
Hi,
Sorry to bother. But the SQL script is not working for me. I'm receiving this message: "#1046 - No database selected"
I need to change order id to 10113.
OpenCart V1.4.9.1
Any help will be greatly appreciated.
Thanks

Re: How to change order_id for Invoice number
Posted: Sat Jul 30, 2011 9:16 pm
by cerami2
I use one pay pal for a few websites i would like the order number to show what website the order came from
were do you change this in opencart i want to put a prefix for the order number
(prepend a prefix if needed (i.e. `xxx_order`) were do i fine this or were do i put it in at the website
Regards
cerami2
Re: How to change order_id for Invoice number
Posted: Thu Aug 25, 2011 4:17 am
by Joxe
HI,
Is this working for 1.5.x?
Thanks.
Re: How to change order_id for Invoice number
Posted: Sat Dec 24, 2011 1:28 am
by iamskyemedia
The command works for order id only. How do you get it to work for the invoice number? I'd like the order id and invoice # to match. I'm working with a numbering system only, not alphas. Please help. Thanks!
JasonC wrote:Qphoria wrote:Execute this simple sql in your phpmyadmin
Code: Select all
ALTER TABLE `order` AUTO_INCREMENT =10000
(prepend a prefix if needed (i.e. `xxx_order`)
Now it will start at 10000
What is the correct syntax to add the prefix?
thanks
Re: How to change order_id for Invoice number
Posted: Tue Feb 07, 2012 2:49 pm
by HorseMagic
tried the sql thingy that everyone was talking about but it didn't work for me either
You do this at your own risk!
It worked for me but hey I don't know what I am doing, I have no technical skills whatsever but I do try to remember exact what I am doing so i can go back to original way if required.
So if there is problems down the track don't complain to me I have no knowledge of problems......
that should read... No problems yet
I will post back here if I find any.
Logged into cpanel,
I went to phpmyadmin,
tried the sql thingy that everyone was talking about but it didn't work for me either,
so went to oc_database,
scrolled down to orders,
clicked on that file,
went to last order
edit
changed the order number
and clicked on Go,
I have put through a couple of orders with no problems
Note: It would only accept changing the number, could not add letters before the number.
Like I said at the beginning, I know NOT what I am doing so its at your own risk and if anyone knows why I can't do it let me know, I am happy to learn

Re: How to change order_id for Invoice number
Posted: Thu Feb 23, 2012 1:43 pm
by storm-cloud
iamskyemedia wrote:The command works for order id only. How do you get it to work for the invoice number? I'd like the order id and invoice # to match. I'm working with a numbering system only, not alphas. Please help. Thanks!]
Did you end up finding out an answer to this? If not, would anyone know how?
We have a previous eCommerce solution and when we do the live switch I would like the order numbers to seamlessly continue. Yes, it would be great if order numbers and invoice numbers matched.
Also, by using executing the SQL command, this didn't make each order go by up by 10,000 did it?
Re: How to change order_id for Invoice number
Posted: Tue Feb 28, 2012 8:48 am
by NikkiC
This worked perfect for me too! Hope it doesn't mess anything up
But it seems to be working!
HorseMagic wrote:tried the sql thingy that everyone was talking about but it didn't work for me either
You do this at your own risk!
It worked for me but hey I don't know what I am doing, I have no technical skills whatsever but I do try to remember exact what I am doing so i can go back to original way if required.
So if there is problems down the track don't complain to me I have no knowledge of problems......
that should read... No problems yet
I will post back here if I find any.
Logged into cpanel,
I went to phpmyadmin,
tried the sql thingy that everyone was talking about but it didn't work for me either,
so went to oc_database,
scrolled down to orders,
clicked on that file,
went to last order
edit
changed the order number
and clicked on Go,
I have put through a couple of orders with no problems
Note: It would only accept changing the number, could not add letters before the number.
Like I said at the beginning, I know NOT what I am doing so its at your own risk and if anyone knows why I can't do it let me know, I am happy to learn

Re: How to change order_id for Invoice number
Posted: Tue Feb 28, 2012 11:56 am
by aresn
if you know what you are doing , then you can use some combination of this script
http://www.tonymarston.net/php-mysql/encryption.html and your own to create a unique order id to present to user. check
http://stackoverflow.com/questions/5387 ... l-order-id
hope this helped
Re: How to change order_id for Invoice number
Posted: Thu Mar 15, 2012 5:36 am
by H2O
dramony wrote:go to you phpmyadmin, click
SQL (located on the top) then paste this on the text area:
Code: Select all
ALTER TABLE `order` AUTO_INCREMENT =10000
Click the
Go button on the right side.
It appears this changed for the newer version of Opencart, the correct code that worked for me on version 1.5.2.1 is:
Code: Select all
ALTER TABLE `oc_order` AUTO_INCREMENT =10000
Re: How to change order_id for Invoice number
Posted: Thu Mar 15, 2012 5:41 am
by NikkiC
Perfect! Thanks for letting us know the update :-)
Re: How to change order_id for Invoice number
Posted: Mon Dec 02, 2013 9:53 am
by Counting Pounds
I've run the myPHP command and that works well for numeric orderID's.
I'm not sure what /how to get Alpha-numeric's for an order ID, not just integers. For example, if I wanted OC-1000 and counting.
I'm planning to copy the order ID into the invoice field (don't need these to be different, but want/need to have some static letters in the invoice#. I need the entire set of characters including the two letters to be in the data stored so we can print etc / simply adding these non-varying letters as prefixes to document template info is no use as there are too many places to edit this.
Re: How to change order_id for Invoice number
Posted: Mon Dec 02, 2013 9:27 pm
by i2Paq
Counting Pounds wrote:I've run the myPHP command and that works well for numeric orderID's.
I'm not sure what /how to get Alpha-numeric's for an order ID, not just integers. For example, if I wanted OC-1000 and counting.
I'm planning to copy the order ID into the invoice field (don't need these to be different, but want/need to have some static letters in the invoice#. I need the entire set of characters including the two letters to be in the data stored so we can print etc / simply adding these non-varying letters as prefixes to document template info is no use as there are too many places to edit this.
In most country's the Invoice numbers must be (by Law) subsequent, using the order numbers this will not happen.
Re: How to change order_id for Invoice number
Posted: Tue Dec 03, 2013 6:21 pm
by Counting Pounds
After struggling thru and getting to it to work i established the following.
1. Order ID can only ever be a number (ie its set to data type integer).
2. If you want letters, then use invoice numbers - I suspect that invoice numbers also have to be intergers (numbers) but you can put letters / symbols before as a prefix - go to system/settings/store to do this.
3. I wanted to simplify stuff, so found an extension that automatically copies the order ID# to the invoice ID#. I now get to track using letters & auto-incremented numbers starting at whatever number I want. The invoice # appears on e.mailied docs without admin intervention.
3. Order ID can start at any number you like using the PHPmyadmin Command below (copied from above contributor). You open PHPmyadmin, go to the SQL tab, paste it in and hit go.
ALTER TABLE `oc_order` AUTO_INCREMENT =10000
Note that the OC_ bit of "oc_order" needs to be changed to reflect the table prefix your hosting company is setup to use. ie the bit of the name that comes before the underscore in the tables that you can see so oc_order becomes mine_order if all the tables in your system were mine_ something
Re: How to change order_id for Invoice number
Posted: Tue Aug 05, 2014 2:58 pm
by actlas
Problem solved:
Code: Select all
MySQL empty result set (0 rows). (query took 0.0946 sec)
ALTER TABLE `jos_mijoshop_order` AUTO_INCREMENT = 7892
Re: How to change order_id for Invoice number
Posted: Wed Jun 03, 2015 12:24 pm
by fred1234
I am at phpMyadmin > SQL and entered the below:
Code: Select all
ALTER TABLE `order` AUTO_INCREMENT =10000
But it says #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Code: Select all ALTER TABLE `order` AUTO_INCREMENT =10000' at line 1
May I know what is my next step?
Re: How to change order_id for Invoice number
Posted: Wed Apr 27, 2016 2:31 am
by bhy
Is this supposed to work in 2.0?
The SQL command was successful but the order numbers don't seem to be changed.
EDIT: it does work, I'm just stupid and didn't realize I need to create a new order to see the effect.
Re: How to change order_id for Invoice number
Posted: Fri May 13, 2016 2:07 pm
by goddy
Thank u!
