4

如何在 Magento 1.5 中自定义订单、发票等的起始编号?

4

4 回答 4

10


来自magento的论坛:

数据库中有一个存储订单增量ID的表。
它被称为“eav_entity_store”表。
您可以通过查看来检查哪个实体类型 id 属于哪个实体
eav_entity_type 表。
您可以运行以下查询来更新订单的最后一个增量 ID。

    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';

使用 phpmyadmin 之类的工具查看您的数据库。在表中
eav_entity_type 您将找到列出的所有实体类型。感兴趣的一个
更改订单号开始的位置是订单销售/订单。记住
entity_type_id(在我的安装中是 11)。删除前导零
(填充)将 increment_pad_length 设置为 1。

接下来转到表 eav_entity_store。查找 entity_type_id。现在轮到你 可以改变 increment_prefix 和 increment_last_id 的值。如果你想 让您的下一个 orderId 为 15000 将 increment_last_id 设置为 14999 和 增量前缀为 0。

此外,您需要制作此文件的副本 /app/code/core/Mage/Eav/Model/Entity/Increment/Abstract.php 到 /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; }

希望有帮助

于 2011-04-30T10:11:40.713 回答
3

Magento 订购不
,这很简单....

  • 去phpmyadmin
  • 选择您的数据库,然后选择表“eav_entity_store”
  • 在此表中,更改increment_last_id(例如,我在表中设置了 3456767)
  • 之后我创建一个新订单。现在我的订单从号码 346768 开始
于 2011-08-26T10:58:42.023 回答
3

实际上,对于较新的版本(可能也在 1.5 中),有一种更简单的方法可以更改它。在 PHPMyAdmin 或您的 mysql 客户端中,转到eav_entity_type表。在entity_type_code列中找到表(可能是order),然后将 设置为increment_pad_length您想要的任何内容,以及increment_pad_char.

然后你不必重写核心代码——双赢。

最大

于 2011-12-01T15:57:36.870 回答
0

实际上有一个很好的扩展来完成这个任务。

它允许您以多种不同的方式自定义订单 ID:例如,您可以使用以下组合:

  1. 像年、月、日、小时、秒这样的数字,
  2. 使用自定义计数器(您可以决定起始编号)
  3. 以上所有方法的组合
  4. 在订单 ID 的任何位置添加一些自定义字符串

这是分机。关于 Magento 连接: http: //www.magentocommerce.com/magento-connect/custom-order-id-8210.html

我亲自尝试过,它非常好(适用于我所有的付款方式,我完全没有问题)

于 2013-09-03T02:43:26.480 回答