3

I need to modify my default invoice number from 100000001 to 2012 - 00001.

I know where I can found increment_last_id in table eav_entity_store. But I don't know what I must set that to be taken new format of invoice number.

Please help with some advice.

7ochem
  • 2,183
  • 1
  • 34
  • 42
Tim Sajt
  • 117
  • 5
  • 11

3 Answers3

1

If you want to do it manually then take a look @ How to Change the Invoice Increment ID and Prefix in Magento (remember to always make a backup)

MagePal Extensions
  • 17,646
  • 2
  • 47
  • 62
1

You can customize order/invoice/creditmemo/shipment number (increment_id) by editing the following class:

Mage_Eav_Model_Entity_Increment_Numeric

Especially, closely look at the code of the following methods:

getNextId(), getPrefix(), getPadLength(), format($id)

Now, you won't find the method definition for methods getPrefix(), getPadLength() because these are magic getter methods. You can define these methods according to your desire.

For an example:

public function getPrefix(){

     $prefix = $this->_getData('prefix');

     /* Do some customization */

    return $prefix;
} 
public function getPadLength()
{ 
     $padLength = $this->_getData('pad_length');

     /* Do some customization */

     return $padLength;
}

This way, you don't have to manually change anything in the database structures for this to achieve.

Hope this will help you.

7ochem
  • 2,183
  • 1
  • 34
  • 42
asmmahmud
  • 4,844
  • 2
  • 40
  • 47
0

The best way to change invoice id is to run following simple sql query:

  1. Check if invoice record exist in eav_entity_store table by running following query

    select * from eav_entity_store where entity_type_id in (select entity_type_id from eav_entity_type where entity_type_code='invoice');

  2. If no record exists, create one dummy invoice from magento backend. Then you will have one record in the table, now run following script:

    update eav_entity_store set increment_last_id="YOUR_DESIRED_INVOICE_ID", increment_prefix='X-' where entity_type_id in (select entity_type_id from eav_entity_type where entity_type_code='invoice')

Try this out and create new invoice:

update eav_entity_store set increment_last_id="0001", increment_prefix='2002' where entity_type_id in (select entity_type_id from eav_entity_type where entity_type_code='invoice')

http://deepakbhatta.com/magento-set-custom-invoice-id/

This works fine to me.

Thanks

Deepak Bhatta
  • 474
  • 4
  • 16