【发布时间】:2011-04-29 23:30:23
【问题描述】:
如何在 Magento 1.5 中自定义订单、发票等的起始编号?
【问题讨论】:
-
有一个易于使用的扩展:magentocommerce.com/magento-connect/…
标签: magento configuration e-commerce magento-1.5
如何在 Magento 1.5 中自定义订单、发票等的起始编号?
【问题讨论】:
标签: magento configuration e-commerce magento-1.5
来自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; }
【讨论】:
实际上,对于较新的版本(可能在 1.5 中也是如此),有一种更简单的方法可以更改它。在 PHPMyAdmin 或您的 mysql 客户端中,转到 eav_entity_type 表。在entity_type_code 列中找到表格(可能是order),然后将increment_pad_length 设置为您想要的任何值,以及increment_pad_char。
那么您就不必重写核心代码——双赢。
JMax
【讨论】:
Magento 订单号
很简单……
increment_last_id(例如我在我的表中设置了3456767)【讨论】:
其实有一个good extension来完成这个任务。
它允许您以多种不同的方式自定义订单 ID: 例如,您可以使用以下组合:
这是分机。在 Magento 连接上: http://www.magentocommerce.com/magento-connect/custom-order-id-8210.html
我亲自尝试过,效果很好(适用于我所有的付款方式,完全没有问题)
【讨论】: