Adding Prefix to Order Numbers in Magento 1.9.01
Are you looking to add a prefix to all future order numbers in your Magento 1.9.01 store? You’ve come to the right place! In this post, we’ll guide you through a step-by-step solution that actually works.
Understanding the Order Number Increment ID and Prefix
Before diving into the code, let’s understand what an order number prefix is in Magento. The order number is generated by a combination of the order increment id (a configurable sequential value) and a prefix. By default, Magento uses ‘000’ as the prefix for new orders.
Modifying the Order Increment ID and Prefix
To add a prefix to your order numbers, you need to modify two key settings:
- Increment ID Prefix: This is the value that will appear before the increment id in each new order number.
- Next Order Increment ID: This controls the starting point for generating the unique part of the order number.
Let’s see how to update these values using the Magento admin panel and then backup up our changes with a database solution as an insurance policy.
Updating Prefix and Next Order Increment ID via Admin Panel
- Log in to your Magento 1.9.01 admin interface.
- Navigate to System > Configuration > Sales > Sales > Orders, then click on the ‘Increase Order Number’ section.
- In the ‘Prefix’ field, enter the desired prefix for your order numbers (e.g., “MAG-”). The default value is 000.
- In the ‘Next Order Increment ID’ field, enter the next sequential number you want to use as the starting point for new orders. This should be one more than the highest existing order id.
Click on Save Config to apply these changes. Now, all future orders will have this prefix and start from the specified increment id.
Backing Up the Changes via Database
While the admin panel updates are effective, it’s a good practice to back up your changes directly in the database as well. This ensures that even if something goes wrong, you can easily revert your previous working state. Here’s how:
- Connect to your Magento 1.9.01 database using an SQL client like MySQL Workbench or phpMyAdmin.
- Find and select the
core_config_datatable. - Run a SQL query to update the relevant fields:
UPDATE core_config_data SET value = 'MAG-' WHERE path = 'sales/increment_prefix';
UPDATE core_config_data SET value = 100 WHERE path = 'sales/next_order_increment_id';
Replace “MAG-” with your desired prefix and 100 with the next sequential id you want to use.
Conclusion
And that’s it! You’ve successfully added a prefix to all future order numbers in your Magento 1.9.01 store. Remember, this change will only affect new orders created after you make these modifications. Any existing orders will retain their original format.
If you’re facing any issues or need further assistance with Magento customizations, don’t hesitate to reach out to us at Laravel Company. Our team of experienced developers is always ready to help you optimize your e-commerce platform for better performance and enhanced user experience.