Issue With Order Id

I wanted to add this topic to the "Issues & Troubleshooting" segment, but for some reason I can't create a new topic there.

I'm having an issue with new orders being added to the database with a strange order id (16777215) and new orders failing because it's trying to add new orders to the datbase with the same id.

It started happening when the setting Initial order ID value under Settings → General got changed to something like 2016001.
Even though 2016001 seems like a normal number to me, it got added to the database as 1677215 and the second order failed because it also wanted to be added as 1677215.

So I deleted the value in Initial order ID value.
I deleted all existing orders in the admin panel (both normal and incomplete orders), deleted all Abandoned / Live carts and checked the database to see if any orders remained (but it was empty).

The new orders got added as order id 1 and 2 and after some more testing it appeared to be working, so after removing order 1 and 2 the next order was 3, but the one after that again got added as 1677215 and the one after that fails again.

I've been looking to find a solution, but can't find what's causing this.

I'm using version 4.3.8.

Sorry, service is temporarily unavailable

P.S. the "Sorry, service is temporarily unavailable" message is what I get when placing a new order now after I choose a payment method.
I wanted to edit my post, but somehow I also can't do that it seems.

16777215 - is the maximum value for the field with the integer type

Check the latest order ID (e.g. 541). Then log in the phpMyAdmin and run the following query:

ALTER TABLE cscart_orders AUTO_INCREMENT = 542;

(Max order ID + 1)

Or go to the "Operations" tab in phpMyAdmin for the cscart_orders table and change that value there. In the Table Options area there is an input box for the AUTO_INCREMENT value. Change it to the next order_id you want to use.


eComLabs's suggestion appears to have worked.

You are welcome!

I have just discovered we have been experiencing this error with customers being unable to place orders over the bank holiday weekend!

The order numbers randomly shot up from 8626 to 16777215+

I managed to reduce back down the auto increment value to get the cart working again - I have no idea why this heppened and am very concerned?

This is a few days after upgrading to the latest version and it was working fine over those days.


Given that it's auto-increment, it is either incremented by 1 for each order placed or someone reset it via either the cs-cart admin UI, programatically (hack) or via something like phpMyAdmin.

Are you using the new responsive admin? It's the newest piece in the puzzle. And since phones are notorious for fat-finger inputs (or errant auto-fills), that could be the source of your problem.

But this is done only via the database isn't it the increment value?

How can i be done from CSCART?

On the Settings/General tab there is a field called "Initial order ID value" that can be set to change the "next auto increment value" in the database.

it was blank - is there any reason not to increase the max integer length just in case?

Yes there is. It is referenced all over the place in various tables. Sometimes by 'order_id' and sometimes by 'object_id'.
I'd find/fix the root of the problem rather than trying to treat the symptom. Blank is okay, it just means it wouldn't be updated. I think it gets set to blank if the settings are changed and it is less than or equal to the current auto_increment value from the orders table (not verified).