如何从洋红色中的特定数字增加订单 ID



In magento,如何从特定号码增加订单ID?例如,当前订单 ID 为 10000031 。我想要 5001 的下一个订单 ID。下一个订单 ID 应该像 5001,5002,5003 ......等。提前谢谢。

检查下面的网址

http://ashsmith.co/2012/12/quick-tip-change-magento-default-increment-id-for-orders-invoices/

希望这对你有帮助

为此,您必须修改数据库以及一些核心代码。

数据库表中的更改:

  1. 更改表"eav_entity_type":

      check row where entity_type_code=order,
      set increment_pad_length=1 
    

查询:

update eav_entity_type set increment_pad_length = '1' where entity_type_id = 5;
  1. 更改表eav_entity_store:

    检查行,其中 entity_type_id = 5;

    设置increment_last_id = '5000'

查询:

update eav_entity_store set increment_last_id = '5000' where entity_type_id = 5;

代码更改:

转到应用程序/代码/核心/法师/Eav/模型/实体/增量/抽象.php

(a) 见代码:

public function getPadLength()
{
    $padLength = $this->getData('pad_length');
    if (empty($padLength)) {
       $padLength = 0; 
    }
    return $padLength;
}

这里改变

$padLength = 0; 

(b) 见代码:

public function format($id)
{
   // $result = $this->getPrefix();
    $result.= str_pad((string)$id, $this->getPadLength(), $this->getPadChar(), STR_PAD_LEFT);
    return $result;
}

注释行:

//$result = $this->getPrefix();

大功告成。如果您对此有任何问题,请告诉我。

最新更新