Developer forum

Forum » Feature requests » Order Number generation at Shop level

Order Number generation at Shop level

Adrian Ursu
Reply

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


Replies

 
Jon Thorne
Jon Thorne
Reply

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 Dynamicweb Employee
Adrian Ursu
Reply

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
Jon Thorne
Reply

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"));
            }
        }
    }