How do I customise the starting number for orders, invoic开发者_StackOverflow社区es etc in Magento 1.5?
From magento's forum:
- by LindyKyaw (Magento Team Member), changing start number (through sql query):
There is a table in the database which stored increment id of order. It is called “eav_entity_store” table. You can check which entity type id belongs to which entity by looking at eav_entity_type table. You can run following query to update last increment id for the order.update eav_entity_store inner join eav_entity_type on eav_entity_type.entity_type_id = eav_entity_store.entity_type_id set eav_entity_store.increment_last_id=3001 where eav_entity_type.entity_type_code='order';
- by FOOMAN (active contributor), changing start number (through db management tool) and removing "0"s at the beginning:
Hope That HelpsWith a tool like phpmyadmin look at your database. In the table eav_entity_type you will find all entity types listed. The one of interest to change where the order number starts is order sales/order. Remember the entity_type_id (in my install it is 11). To remove the leading zeros (padding) set increment_pad_length to 1.Next go to the table eav_entity_store. Look up the entity_type_id. Now you can change the value of increment_prefix and increment_last_id. If you wanted to have your next orderId to be 15000 set increment_last_id to 14999 and increment_prefix to 0.
Additionally you need to make a copy of this file /app/code/core/Mage/Eav/Model/Entity/Increment/Abstract.php to /app/code/local/Mage/Eav/Model/Entity/Increment/Abstract.php
public function getPadLength() { $padLength = $this->getData('pad_length'); if (empty($padLength)) { $padLength = 0; } return $padLength; } ... public function format($id) { $result= str_pad((string)$id, $this->getPadLength(), $this->getPadChar(), STR_PAD_LEFT); return $result; }
Actually with the newer versions (and probably in 1.5 as well), there is an easier way to change it. In PHPMyAdmin, or your mysql client, go to the eav_entity_type
table. Locate the table in the entity_type_code
column (probably order
), and set the increment_pad_length
to be whatever you would like, as well as the increment_pad_char
.
Then you don't have to rewrite core code - a win-win.
JMax
Magento Order No
It's simple....
- go to phpmyadmin
- select your datbase and then select the table "eav_entity_store"
- in this table, change the
increment_last_id
(for example, I have set 3456767 in my table) - after that I create a new order. Now my orders start from the number 346768
There is actually a good extension for accomplish this task.
It allows you to customize the order ID in a lot of different way: for example you can use a combination of:
- number like year,month,,day,hr,sec,
- use a custom counter (you can decide the starting number )
- a combination of all above methods
- add some custom string in any position of the order ID
This is the ext. on Magento connect: http://www.magentocommerce.com/magento-connect/custom-order-id-8210.html
I personally tried it and it very good ( works fine with all my payment methods and I had no issue at all )
精彩评论