【问题标题】:Custom Start Number for Order Numbers in Magento 1.5Magento 1.5 中订单号的自定义起始编号
【发布时间】:2011-04-29 23:30:23
【问题描述】:

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

【问题讨论】:

标签: magento configuration e-commerce magento-1.5


【解决方案1】:


来自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 和 increment_prefix 为 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; }

希望有帮助

【讨论】:

    【解决方案2】:

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

    那么您就不必重写核心代码——双赢。

    JMax

    【讨论】:

      【解决方案3】:

      Magento 订单号
      很简单……

      • 转到 phpmyadmin
      • 选择您的数据库,然后选择表“eav_entity_store”
      • 在这个表中,更改increment_last_id(例如我在我的表中设置了3456767)
      • 之后我创建了一个新订单。现在我的订单从号码 346768 开始

      【讨论】:

      • 我试过这个,它适用于订单号,但订单ID不同。例如,当我下订单并点击订单详情时,url 为:sales/order/view/order_id/7/
      【解决方案4】:

      其实有一个good extension来完成这个任务。

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

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

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-08-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-02-21
        • 2012-11-16
        • 1970-01-01
        相关资源
        最近更新 更多