gpt4 book ai didi

magento - Magento 1.5 中订单号的自定义起始号

转载 作者:行者123 更新时间:2023-12-04 21:54:21 25 4
gpt4 key购买 nike

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

最佳答案

来自 magento 的论坛:

  • by LindyKyaw (Magento Team Member) , 更改起始编号(通过 sql 查询):

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

  • by FOOMAN (active contributor) ,更改起始编号(通过数据库管理工具)并删除开头的“0”:

  • 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.phpto/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;
    }

    希望有帮助

    关于magento - Magento 1.5 中订单号的自定义起始号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5838368/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com