如何在Magento 1.5中自定义订单,发票等的起始编号?
答案 0 :(得分:10)
来自magento的论坛:
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';
希望有助于With 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; }
答案 1 :(得分:3)
Magento订单号
这很简单......
increment_last_id
(例如,我在表格中设置了3456767)答案 2 :(得分:3)
实际上对于较新的版本(也可能在1.5版本中),有一种更简单的方法来更改它。在PHPMyAdmin或您的mysql客户端中,转到eav_entity_type
表。找到entity_type_code
列中的表格(可能是order
),并将increment_pad_length
设置为您想要的任何内容,以及increment_pad_char
。
然后你不必重写核心代码 - 双赢。
JMAX
答案 3 :(得分:0)
实际上有good extension来完成这项任务。
它允许您以许多不同的方式自定义订单ID: 例如,您可以使用以下组合:
这是分机。在Magento连接: http://www.magentocommerce.com/magento-connect/custom-order-id-8210.html
我亲自尝试过,非常好(我的所有付款方式都运行良好,我根本没有问题)