Changing Magento’s Numbering System
I noticed in the forums over at magento, there seems to be a lot of talk about how to set the starting numbers for orders, invoices, shipments, and credit memos.
Here is what works for me on Magento ver 1.2.0.1 and should help you with other similar releases. This explains “how to” do it, so you can customize it to work for you.
Edit SQL through phpMyAdmin
Go to:
phpmyadmin>your_mag_db>eav_entity_store>Browse>
To keep it simple; In order to auto create these rows (if they are not already in your_mag_db), first place an order on the store, then invoice, then ship, then credit memo (in any order).
- 1.2.x and Similar
- Ubuntu Server (Linux)
- Easy to Moderate
- SQL and Core files.
- Don’t use a live site for testing.
You should now see these entity_type_id entries, now edit each entry like so (or whatever fits your scheme):
| entity_store_id | entity_type_id | store_id | increment_prefix | increment_last_id |
|---|---|---|---|---|
| 1 | 4 | 1 | 1 | 100077161 |
| 2 | 18 | 1 | 2 | 200064855 |
| 3 | 24 | 1 | 3 | 300164557 |
| 4 | 1 | 0 | 0 | 000002342 |
| 5 | 28 | 1 | 4 | 400002347 |
For your reference:
entity_type_id 4 = order
entity_type_id 18 = invoice
entity_type_id 24 = shipment
entity_type_id 28 = credit memo
Also, if you are using your own custom starting numbers, make sure increment_prefix matches start of increment_last_id (like above).
Magento Core File
This is completely optional and used if you want a gap between each order, invoice, ship, memo created.
Now modify your \magento_install\app\code\core\Mage\Eav\Model \Entity \Increment\Numeric.php by
changing this line:
$next = $last+1;
to this:
$next = $last+3; //increases each number by three.
Summary
Your orders will start at 100077161, your invoices start at 200064855, your shipments start at 300164557, and your credit memos start at 400002347. Each number will be increased by 3 each time an order, invoice, ship, or memo is created.
Hack Note: This hack will modify one of your mage core files, so always work on a dev install of your mag store, and make or cron job “sql and file” backups frequently. Also, make a note of this mod, for future magento updates.


















" Change Magento Starting Numbers for eav_entity_store "
Thanks for this!!
Perhaps just a note that it is not wise to increment invoice numbers by 3…. But it’s good to know how to do it nevertheless.
Cheers
" Change Magento Starting Numbers for eav_entity_store "
Thanks for this interesting tutorial. I’d like to know if there’s a simple way to share the increment ID with de different stores ?
Currently, there’s a ID by store view, I’d like to have the same incremented ID for my all store views, any idea ? thanks