任何人都知道为什么 sales_flat_order 表中的 entity_id 会跳转而不是顺序递增?
mysql> SELECT entity_id FROM sales_flat_order;
+-----------+
| entity_id |
+-----------+
| 1 |
| 8 |
| 13 |
+-----------+
3 rows in set (0.00 sec)
任何人都知道为什么 sales_flat_order 表中的 entity_id 会跳转而不是顺序递增?
mysql> SELECT entity_id FROM sales_flat_order;
+-----------+
| entity_id |
+-----------+
| 1 |
| 8 |
| 13 |
+-----------+
3 rows in set (0.00 sec)
当 Magento 进入结帐过程时,它会“保留”一个 increment_id 并将其放在报价(购物车)对象上。您可以在以下位置查看获取增量 id 的代码:
Mage_Eav_Model_Entity_Type::fetchNewIncrementId()
存在此行为是为了允许 Magento 在订单完成之前向支付网关发送最终订单 ID (increment_id),从而允许网关将订单 ID 与订单相关联。如果客户放弃网关中的支付流程。
如果您想找到您的“缺失”increment_id,请查看字段 reserved_order_id 下的 sales_flat_quote。您应该看到它们附加到未转换的报价对象。
这里有很好的答案。 magento 订单 id 增量跳跃