如何为Magento 1.9.01中的所有未来订单号添加前缀?我已经试过了数据库解决方案说明如下:如何为订单号添加前缀
http://www.warpconduit.net/2012/04/18/how-to-change-the-order-increment-id-and-prefix-in-magento
但这并没有影响。新订单没有前缀。
如何为Magento 1.9.01中的所有未来订单号添加前缀?我已经试过了数据库解决方案说明如下:如何为订单号添加前缀
http://www.warpconduit.net/2012/04/18/how-to-change-the-order-increment-id-and-prefix-in-magento
但这并没有影响。新订单没有前缀。
您是否尝试改写类Mage_Eav_Model_Entity_Type
并在方法fetchNewIncrementId
中添加自定义订单号逻辑?
像
public function fetchNewIncrementId($storeId = null)
{
$incrementId = parent::fetchNewIncrementId($storeId);
$incrementId = 'prefix' . $incrementId;
return $incrementId;
}
Find all order id
SELECT core_store_group.name AS group_name, core_website.name AS website_name, core_store.name AS store_name, core_store.store_id, increment_prefix, increment_last_id, entity_type_code
FROM eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
INNER JOIN core_store ON core_store.store_id = eav_entity_store.store_id
INNER JOIN core_store_group ON core_store_group.group_id = core_store.group_id
INNER JOIN core_website ON core_website.website_id = core_store.website_id
WHERE eav_entity_store.store_id != 0 ORDER BY eav_entity_store.store_id;
Change your Order Prefix on All Stores
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_prefix='SPB'
WHERE eav_entity_type.entity_type_code='order';
Change your Invoice Prefix on All Stores
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_prefix='SPB'
WHERE eav_entity_type.entity_type_code='invoice';
Change your Shipment Prefix on All Stores->
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_prefix='SPB'
WHERE eav_entity_type.entity_type_code='shipment';
Change your Credit Memo Prefix on All Stores
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_prefix='SPB'
WHERE eav_entity_type.entity_type_code='creditmemo';
你通过改变店铺ID – 2014-09-01 12:28:20
你可以钩到'sales_order_place_after'事件和编程修改增量ID试过吗? – Kenny 2014-09-01 13:47:11