Shortening Increment ID length for Orders, Invoices, and Shipments
We recently had a client who needed to shorten the default Magento Increment ID length from the default 9 characters (eg 100000000) to 6 characters. This can be accomplished by modifying the "increment_pad_length" in the "eav_entity_type" for whatever entity you're wanting to modify. Here is a screenshot of the resulting table:
If you're wanting to change the number from which Magento starts counting orders/invoices/shipments, or wanting to change the prefix for those entities, check out this great post by Timothy at Elias: http://eliasinteractive.com/blog/magento-ecommerce-how-to-reset-all-test...
Posted on October 3, 2009
Posted by Erik Hansen
Add comment
Blog Categories
- Design (3)
- Development (9)
- Magento Development (26)
- PHP (1)
- Security (0)
- E-Commerce (5)
- General Business (5)
- Llama Culture (2)
- Magento (55)
- Management (4)
- Wiz (2)
- Online Marketing (1)
- Productivity (2)
- Uncategorized (4)

Comments
Is better if you can avoid to
Is better if you can avoid to use an SQL request in an installer :)
$entityType = Mage::getModel('eav/entity_type')->loadByCode('order');
$entityType->setIncrementPadLength(7)->save();
Should have said we are on
Should have said we are on 1.4.1.1
This worked for me: UPDATE
This worked for me:
UPDATE `eav_entity_type` SET `increment_pad_length`=4 WHERE entity_type_code = 'order';
UPDATE `eav_entity_type` SET `increment_pad_length`=4 WHERE entity_type_code = 'creditmemo';
UPDATE `eav_entity_type` SET `increment_pad_length`=4 WHERE entity_type_code = 'invoice';
UPDATE `eav_entity_type` SET `increment_pad_length`=4 WHERE entity_type_code = 'shipment';
Use this, manually editIng
Use this, manually editIng won't work:
update `eav_entity_type` set `increment_pad_length`=6 where `entity_type_code`='order';
Hmm. You know, this didn't
Hmm. You know, this didn't work for us. Do we need to truncate the test orders table first and work with a clean slate? Or do I need to update the last number with the proper length as well for it to work?
You should take a look in
You should take a look in your sales_order_entity and look for rows with their entity_type_id equalling 16. If the increment_id field is 7 characters, then the directions worked.
Hi, I posted this on the
Hi,
I posted this on the Magento forum just now as well. I followed the directions here to change the default 8 characters for invoice to 7, and I don’t think it worked for me. My credit card extension only allows 7 characters in the invoice field. So I changed invoice, invoice_item, and invoice_comment under the entity_type_code in my database to 7. I’m still getting an error when I try to post an order that says: “Declined: Field Format Error.” Any suggestions on this?