最新消息:觉得本站不错的话 记得收藏哦 博客内某些功能仅供测试 讨论群:135931704 快养不起小站了 各位有闲钱就打赏下把 My Email weicots#gmail.com Please replace # with @

How To Change Order Prefix And Default Value Of Order/Shipment/Invoice Number/Credit Memo In Magento/Magento 的订单号 的事

Magento 资料整理 ajiang-tuzi 4368浏览

As you have by now set your own magento store and you see that the order number a customer gets after purchasing starts from100000001. But as its your new store and you don’t want your store to look like an amateur to others, you thought of changing the value of the order/shipment/invoice/credit memo number. But as you might have found out that there is no option in magento to change the value of this. Also it occurred to you that you want to modify in a way that it has a prefix related to your store name. e.g. Your store name is BestBooks.com, so you want that your order number looks like BB10023123. It looks definitely better than the default.

Change_Order_Prefix_Value_Magento

So I would now like to proceed to show you how its done.

You must back up your complete website including database first. Also try this on your demo website first to see whether your live website would accept it.
This has been tested on Magento Community Edition v 1.6.2.0 and 1.7.0.2. So it will probably work for the later versions also.

How to find your store’s current order/shipment/invoice /credit memo number

  • ?Login to the Cpanel and go to phpMyAdmin
  • ?Select the database in which your magento installation is running.
  • ?Go to SQL.
  • ?Run the codes.
SELECT core_store_group.name AS group_name, core_website.name AS website_name, core_store.name AS store_name, core_store.store_id, increment_prefix, increment_last_id, entity_type_code
FROM eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
INNER JOIN core_store ON core_store.store_id = eav_entity_store.store_id
INNER JOIN core_store_group ON core_store_group.group_id = core_store.group_id
INNER JOIN core_website ON core_website.website_id = core_store.website_id
WHERE eav_entity_store.store_id != 0 ORDER BY eav_entity_store.store_id;
When making changes keep in mind that the increment_prefix field type is varchar(20) and that the increment_last_id field type is varchar(50)
Now the changing part

Change The Order Number And Prefix

 

Change order number value (All Stores)

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='order';
Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and press Go

 

Change the order prefix (All Stores)

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_prefix='X'
WHERE eav_entity_type.entity_type_code='order';
Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL?(no quotes) to disable the order prefix, then run the query.DO NOT set the increment prefix to NULL on anything less than v1.6.0

Change order number value (Specific Store)

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='order' AND eav_entity_store.store_id = 'Y';
Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and?replace Y with the store ID of the store you want to modify. The press Go.

 

Change the order prefix (Specific Store)

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_prefix='X'
WHERE eav_entity_type.entity_type_code='order' AND eav_entity_store.store_id = 'Y';
Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL?(no quotes) to disable the order prefix. Replace Y with the store ID of the store you want to modify, then run the query.DO NOT set the increment prefix to NULL on anything less than v1.6.0.

change_order_number_magento

change_order_number_magento2

 

Change Invoice Number and Prefix

Change?Invoice number value (All Stores)

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='invoice';
Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and press Go

 

Change the?Invoice prefix (All Stores)

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_prefix='X'
WHERE eav_entity_type.entity_type_code='invoice';
Change the “X” in the above code to whatever you want e.g. BB and press Go. SetXtoNULL (no quotes) to disable the order prefix, then run the query.DO NOT set the increment prefix to NULL on anything less than v1.6.0

 

Change Invoice number value (Specific Store)

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='invoice' AND eav_entity_store.store_id = 'Y';
Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and?replace Y with the store ID of the store you want to modify. The press Go.

 

Change the?Invoice prefix (Specific Store)

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_prefix='X'
WHERE eav_entity_type.entity_type_code='invoice' AND eav_entity_store.store_id = 'Y';
Change the “X” in the above code to whatever you want e.g. BB and press Go. SetX toNULL (no quotes) to disable the order prefix. ReplaceY with the store ID of the store you want to modify, then run the query.DO NOT set the increment prefix to NULL on anything less than v1.6.0.

 

Change Shipment Number and Prefix

Change?Shipment number value (All Stores)

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='shipment';
Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and press Go

 

Change the?Shipment prefix (All Stores)

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_prefix='X'
WHERE eav_entity_type.entity_type_code='shipment';
Change the “X” in the above code to whatever you want e.g. BB and press Go. SetX toNULL (no quotes) to disable the order prefix, then run the query.DO NOT set the increment prefix to NULL on anything less than v1.6.0

 

Change?Shipment number value (Specific Store)

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='shipment' AND eav_entity_store.store_id = 'Y';
Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and?replace Y with the store ID of the store you want to modify. The press Go.

 

Change the?Shipment prefix (Specific Store)

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_prefix='X'
WHERE eav_entity_type.entity_type_code='shipment' AND eav_entity_store.store_id = 'Y';
Change the “X” in the above code to whatever you want e.g. BB and press Go. SetX toNULL (no quotes) to disable the order prefix. ReplaceY with the store ID of the store you want to modify, then run the query.DO NOT set the increment prefix to NULL on anything less than v1.6.0.

 

change_order_prefix_magento

change_order_prefix_magento2

Change Credit Memo Number and Prefix

Change?Credit Memo number value (All Stores)

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='creditmemo';
Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and press Go

 

Change the?Credit Memo prefix (All Stores)

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_prefix='X'
WHERE eav_entity_type.entity_type_code='creditmemo';
Change the “X” in the above code to whatever you want e.g. BB and press Go. SetX toNULL (no quotes) to disable the order prefix, then run the query.DO NOT set the increment prefix to NULL on anything less than v1.6.0

 

Change?Credit Memo number value (Specific Store)

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='creditmemo' AND eav_entity_store.store_id = 'Y';
Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and?replace Y with the store ID of the store you want to modify. The press Go.

 

Change the?Credit Memo prefix (Specific Store)

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_prefix='X'
WHERE eav_entity_type.entity_type_code='creditmemo' AND eav_entity_store.store_id = 'Y';
Change the “X” in the above code to whatever you want e.g. BB and press Go. SetX toNULL (no quotes) to disable the order prefix. ReplaceY with the store ID of the store you want to modify, then run the query.DO NOT set the increment prefix to NULL on anything less than v1.6.0.

 
引用及备注
本文来自thevortexcode 的博客

转载请注明:(●--●) Hello.My Weicot » How To Change Order Prefix And Default Value Of Order/Shipment/Invoice Number/Credit Memo In Magento/Magento 的订单号 的事

蜀ICP备15020253号-1