如何从magento中的特定数字增加订单ID

时间:2014-03-01 13:15:26

标签: magento

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

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

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

数据库表格的变更:

  1. 更改表'eav_entity_type':

      check row where entity_type_code=order,
      set increment_pad_length=1 
    
  2. <强>查询:

    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'

    2. <强>查询:

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

      代码更改

      转到app / code / core / Mage / Eav / Model / Entity / Increment / Abstract.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();
      

      你已经完成了。如果你对此有任何问题,请告诉我。

相关问题