In cases with multiple shops it would be nice to have the ability to set the AutoNumbering rule at shop level instead of application level. OrderID can remain unique or there can me a mixed Key formed of OrderID and ShopID
Developer forum
E-mail notifications
Order Number generation at Shop level
Adrian Ursu
Replies
Jon Thorne
Posted on 27/04/2023 06:48:32
Hi Adrian,
I was just about to ask this very same thing. We want to have a different prefix for orders in each shop. But perhaps not such a common request as it seems that this is still a feature request for the last 7 years.
Any update here?
Jon.
Adrian Ursu
Posted on 27/04/2023 09:15:03
Hi Jon,
There is no change from what I know.
We had to customize the logic. It's not that often but it arises from time to time, when we try to implement 2 separate shops in the same solution.
Adrian
Jon Thorne
Posted on 27/04/2023 09:35:25
For anyone looking for how to do this I have found that there is a notification subscriber where you can modify the order number when converting from a cart to an order.
[Subscribe(Ecommerce.Cart.OrderIsPassedToCheckoutHandler)]
public class UL_OrderNumber_OrderIsPassedToCheckoutHandler : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
Ecommerce.Cart.OrderIsPassedToCheckoutHandlerArgs orderIsPassedToCheckoutHandlerArgs = args as Ecommerce.Cart.OrderIsPassedToCheckoutHandlerArgs;
if (orderIsPassedToCheckoutHandlerArgs.Order.ShopId == "SHOP7")
{
var os = new OrderService();
os.UpdateOrderId(orderIsPassedToCheckoutHandlerArgs.Order, NumberGenerator.GetNumber("ORDER-UL"));
}
}
}