Magento – Custom Order Number or Increment ID

increment-idmagento-1.7orders

I want to shorten order number (increment id) but I don't want to use any modules.

Best Answer

To reduce the number of digits, you'll want to modify the increment_pad_length in the eav_entity_type table (for the order row, of course).

You can change the prefix by modifying the increment_prefix value in the eav_entity_store table. (Use the entity_type_id from the other table to identify which row you'd change.) By default, Magento uses the store's id (1) as the prefix.

If you're interested in learning more about the increment IDs, check out the Mage_Eav_Model_Entity_Increment_Numeric and Mage_Eav_Model_Entity_Increment_Abstract classes which are responsible for generating the next available ID based on the database settings.

Edit: You could even create your own increment logic by extending the Abstract class I mentioned above.