16

Is there any way to change Order Starting Number in Magento without changing order numbers that are already there? I just want to set 170000xxxx for all new orders.

Thanks

FlourishDNA
  • 500
  • 1
  • 8
  • 20
  • You shouldn't do it because first number in order increment id is store id where order was placed. Some extensions may rely on it. – Dmytro Zavalkin Feb 23 '12 at 21:39
  • possible duplicate of [Custom Start Number for Order Numbers in Magento 1.5](http://stackoverflow.com/questions/5838368/custom-start-number-for-order-numbers-in-magento-1-5) – Donal Fellows Nov 15 '12 at 11:54

4 Answers4

32

Look in eav_entity_store and find increment_last_id. Update this number, making sure that entity_type_id is correct for orders.

Find the entity_type_id for orders

SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'order';

Zachary Schuessler
  • 3,644
  • 2
  • 28
  • 43
  • I guess entity type id for order is always 4 or one should at least match the last order number with the value in increment_last_id. – atif Sep 16 '13 at 07:11
  • The entity_type_id for "order" for my installations always seems to be 5. I would use the query given above to always check what the correct id is for a given installation. – Doug Knudsen Nov 07 '15 at 17:52
5

Sankar had it almost right

UPDATE `database`.`eav_entity_store` SET `increment_last_id` = '17000000' WHERE `entity_store_id` = 1;
Steve Ross
  • 1,228
  • 10
  • 21
  • No.. He got it wrong, advising it's the store ID. It should be the Order entity ID. See first comment to Sankar's answer. – justabuzz Aug 25 '16 at 03:19
5

The simplest solution for this is to use Ashley Schroder's "Set Custom Order Number" extension. This extension, once installed, makes changing the next order number a simple operation you can do through the back end.

Regardless of the method used, make sure your new order number sequence doesn't include existing orders, otherwise bad things happen (unique constraints in the database not satisfied, Magento crashes).

Jim OHalloran
  • 5,859
  • 2
  • 37
  • 57
  • Looks like that extension has been deleted. Here is another extension which lets you change your order numbers along with other options: http://www.magentocommerce.com/magento-connect/custom-order-invoice-shipment-numbers.html – Junaid Bhura Oct 08 '14 at 12:51
  • It's still available directly from Ashley's web site... http://www.aschroder.com/category/set-start-order-number-extension/ Link updated. – Jim OHalloran Oct 08 '14 at 22:52
3
UPDATE `eav_entity_store` SET `increment_last_id` = '30000000' WHERE `entity_type_id` = STOREID;`

STOREID -> The store id which you are using.

Sankar Subburaj
  • 4,992
  • 12
  • 48
  • 79
  • 2
    This is incorrect. You are conflating entity_type_id and store_id. I believe you meant to say something along the lines of: UPDATE eav_entity_store SET increment_last_id = '30000000' WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'order'); – Matt Pavelle Apr 27 '14 at 21:16