Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Order number problems

Dr Lemons

Recommended Posts

Well i am in the process of starting up my store, however i have encountered a problem with the order numbers. I will try and explain clearly for you guys.


I know that the order number shows up as the order_id from the database, however here comes the problem. If i was to create two accounts on my website and the first user was to order 3 things, that would create the order_id to 3, and then if the second user was to order two more items this would put the order_id to 5. Then here comes the problem, if the second user was to view his/her previous order it would be named as order number 5 and 6 instead of 1 and 2, which it should be. This will carry on for example if the first orders another item then the order_id will change to 7 and the order number will be 7 instead of 4 which it should be.


Is there any way around this? :wacko:



Link to comment
Share on other sites

@@Dr Lemons


Sounds like you have altered some code in the orders.php or another associated file that is creating the problem. The database generates the order number using an auto-increment, it is not determined from the cart quantity. So, something is writing to the order_id field, and it should not be.






Link to comment
Share on other sites

I agree with Chris in that somebody did something non-standard to the order_id. That is an auto-incremented field in the table that should be left alone (read-only) and never altered for any reason. Do you have any custom coding involving this field? What add-ons are installed? Also, rather than altering the order_id directly, is there any code that keeps INSERTing new order records (say, per item), when just one will do (per order)? That would result in "high" order numbers and bloat the table with orphaned order records. Perhaps there is code that INSERTs rather than UPDATEs the order record?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...