Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Custom order number, or at least custom starting number
 
lightwing
Jr. Member
 
Total Posts:  8
Joined:  2009-09-22
 
stevecgarry - 16 March 2010 11:44 AM

on a very basic site I did a while back, where we had exactly this issue, I did a very smple order number.

Format is yymmdd-99999, where the number is reset to one on the first order after midnight. That was one line of code that checks the date against the date of the order, and if they don’t agree, it changes the date to the current date, and then resets the number to 1. The next number then sees the correct date, so adds 1 to the sequence and then saves it back to file.

Avoids the numbers being given away, and provides a unique number for future checks and looking up.


Steve

Hi Steve,

Could you share how to do it?

Thanks.

Caesar

 
Magento Community Magento Community
Magento Community
Magento Community
 
bolasevich
Sr. Member
 
Avatar
Total Posts:  235
Joined:  2008-03-04
Newington, CT USA
 

this extension also imports custom order numbers -->

 
Magento Community Magento Community
Magento Community
Magento Community
 
bolasevich
Sr. Member
 
Avatar
Total Posts:  235
Joined:  2008-03-04
Newington, CT USA
 

this extension also does custom order numbers in bulk --> http://www.magentocommerce.com/magento-connect/bolasevich/extension/2063/dataflow-batch-import-+-export-orders-to-csv--xml/

 
Magento Community Magento Community
Magento Community
Magento Community
 
EdVerm
Jr. Member
 
Total Posts:  25
Joined:  2010-05-23
 
stevecgarry - 16 March 2010 11:44 AM

on a very basic site I did a while back, where we had exactly this issue, I did a very smple order number.

Format is yymmdd-99999, where the number is reset to one on the first order after midnight. That was one line of code that checks the date against the date of the order, and if they don’t agree, it changes the date to the current date, and then resets the number to 1. The next number then sees the correct date, so adds 1 to the sequence and then saves it back to file.

Avoids the numbers being given away, and provides a unique number for future checks and looking up.


Steve

Hi Steve,

Could you share it with us or a link to that site would be greatfull

Best regard
Ed

 
Magento Community Magento Community
Magento Community
Magento Community
 
scree
Sr. Member
 
Avatar
Total Posts:  137
Joined:  2008-07-14
Linz
 

I would recommend to buy Aitocs Extension. Works great.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lijithmg
Jr. Member
 
Total Posts:  10
Joined:  2009-11-17
Kochi, Kerala, India
 
Moshe - 24 April 2008 06:27 PM

Run this on your database:

update `eav_entity_typeset `increment_pad_length`=6 where `entity_type_code`='order';
This should do the trick.

Don’t forget to clean EAV cache.

This works like a charm. One modification to make:
If you want 6 decimals of order number you have to run the query

update `eav_entity_typeset `increment_pad_length`=5 where `entity_type_code`='order';
ie., the number should be one less.
 
Magento Community Magento Community
Magento Community
Magento Community
 
ASchroder
Member
 
Avatar
Total Posts:  49
Joined:  2008-10-09
New Zealand
 

Second post in this thread, nearly two years later!

I got sick of doing this manually, and didn’t know about the paid one (that will teach me not to subscribe to threads).

Anyway I made a simple extension to do it (it’s free and open source) - it’s NOT as full featured as the paid one mentioned earlier, but if demand is high, I’ll add some features. So let me know.

You can get it here:
http://www.magentocommerce.com/magento-connect/ASchroder/extension/4088/aschroder_setstartordernumber

And I wrote up how it was made and how it works here:
http://www.aschroder.com/2010/07/easily-set-a-custom-order-number-in-magento-with-my-free-setstartordernumber-extension/

Feedback, bugs, feature ideas all welcome - please let me know.

 
Magento Community Magento Community
Magento Community
Magento Community
 
pezomatic
Sr. Member
 
Avatar
Total Posts:  190
Joined:  2008-11-05
 
ASchroder - 28 July 2010 06:32 PM

I got sick of doing this manually, and didn’t know about the paid one (that will teach me not to subscribe to threads).

Anyway I made a simple extension to do it (it’s free and open source) - it’s NOT as full featured as the paid one mentioned earlier, but if demand is high, I’ll add some features. So let me know.

You can get it here:
http://www.magentocommerce.com/magento-connect/ASchroder/extension/4088/aschroder_setstartordernumber

ASchroder, thanks so much for sharing this.

Using your extension am I able to add a letter prefix to my invoice number?
(Invoice# W3755, W3756, W3757, etc.)

With our current (non-magento) website we put a “W” prefix on all of our weborders so we can easily identify them in our accounting system and I need a way to maintain this system in Magento before I take our store live.

 
Magento Community Magento Community
Magento Community
Magento Community
 
LazyMech
Jr. Member
 
Total Posts:  26
Joined:  2010-06-16
 

@jetsetter THX a lot. Your solution solves the problem of displaying \’0\’ instead of order number in case of alphanumeric character usage in order number. But want to add some minor things:

1- Instead of deleting

\'type\'      => \'number\',
change it to
\'type\'      => \'text\',

2- You have to do it also for

$this->addColumn(\'order_increment_id\', array(
            
\'header\'    => Mage::helper(\'sales\')->__(\'Shipment #\'),
            
\'index\'     => \'increment_id\',
            
\'type\'      => \'number\',
        ));
3- You have to do it also for Shipment/Grid.php Invoice/Grid.php CreditMemo/Grid.php
 
Magento Community Magento Community
Magento Community
Magento Community
 
Frinkle
Jr. Member
 
Total Posts:  1
Joined:  2009-07-18
 

I’m not sure it’s the correct way to do it but here’s how I changed my orders/invoices/shipments/credit memos numbers to “YYYYMMDDcode” :

1) In the table eav_entity_type, change the increment_model values of the types you want to change to “eav/entity_increment_date”

2) Create a new file : local/Mage/Eav/Model/Entity/Increment/Date.php

3) Insert this code :

class Mage_Eav_Model_Entity_Increment_Date
    
extends Mage_Eav_Model_Entity_Increment_Abstract
{
    
public function getPadLength()
    
{
        
return 14// Replace that by the desired length of your order ID, or just delete this method and use the DB value
    
}
    
    
public function getNextId()
    
{
        $next 
str_pad((string)rand(1,999999), 6'0'STR_PAD_LEFT); // Replace this by your custom code algorithm
        
        
return date('Ymd').$next;
    
}
}

4) Place an order and you’ll have a date based number

As this thread is 6 pages long and it seems easy to change the orders ID formating, I’m afraid of drawbacks, but I don’t know which ones…

 
Magento Community Magento Community
Magento Community
Magento Community
 
ComitDevelopers
Jr. Member
 
Total Posts:  3
Joined:  2011-04-06
 

does anybody know how to change the customer number ??

 
Magento Community Magento Community
Magento Community
Magento Community
 
HarryM
Member
 
Total Posts:  40
Joined:  2008-06-17
 

I need to change the Shipment Number - can anyone help with this?  Please!

 
Magento Community Magento Community
Magento Community
Magento Community
 
maria_atwix
Sr. Member
 
Avatar
Total Posts:  129
Joined:  2012-01-23
 

Hello! Our team has solution on the similar topic posted here http://www.atwix.com/magento/custom-order-and-customer-numbers-2/

Hope this information will be useful

 
Magento Community Magento Community
Magento Community
Magento Community
 
Darkness333
Jr. Member
 
Total Posts:  3
Joined:  2012-04-04
 

The best way is to buy complete extension for this problem. You wont spend hours of trying some pieces of code which only maybe works. And finally you also have admin interface for custom settings.

For example you can try these complete extensions:
http://www.magentocommerce.com/magento-connect/custom-order-numbering-and-custom-invoice-numbers-5283.html
or
http://www.magentocommerce.com/magento-connect/flexinvoice-custom-invoice-number-and-custom-order-number.html

Hope it helps.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Extendware
Sr. Member
 
Avatar
Total Posts:  231
Joined:  2011-08-04
 

For all your numbering needs I highly recommend Custom Order Numbers Magento Extension

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top