如何在Magento 1.9.01中为所有未来的订单号添加前缀?我已经尝试了这里描述的数据库解决方案:
http://www.warpconduit.net/2012/04/18/how-to-change-the-order-increment-id-and-prefix-in-magento
但这没有效果。新订单没有前缀。
答案 0 :(得分:3)
您是否尝试重写课程Mage_Eav_Model_Entity_Type
并在方法fetchNewIncrementId
中添加自定义订单号逻辑?
像
public function fetchNewIncrementId($storeId = null)
{
$incrementId = parent::fetchNewIncrementId($storeId);
$incrementId = 'prefix' . $incrementId;
return $incrementId;
}
答案 1 :(得分:0)
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';