Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • M N 125 posts 212 karma points
    Aug 19, 2018 @ 20:21
    M N

    Manually set order to Unfulfilled still shows Fulfilled on sales table label without events?

    Hey all,

    So I have the following code working, and I can set the status of all the orders in an invoice to Unfullfilled/Fulfilled etc.. However, I was curious why, if I don't "raise events", the label does NOT get updated on sales listings? I'm more just curious what's going on under the hood here as I don't want anything "handled for me" if that makes sense. Plus our clients process is super unique, and it simply can't fit inside Merchello's shipping paradigm. But I do plan on using the status collections!

    Anywho, below code will move it in the Sales Collections. But the label is not updated. Are they really separate somehow?

    public void SetInvoiceOrdersToUnfulfilled(string invoiceKey)
        var invoiceService = MerchelloContext.Current.Services.InvoiceService;
        var orderService = MerchelloContext.Current.Services.OrderService;
        var invoice = invoiceService.GetByKey(new Guid(invoiceKey));
        IEnumerable<IOrder> orders = orderService.GetOrdersByInvoiceKey(new Guid(invoiceKey));
        foreach (IOrder order in orders)
            IOrderStatus orderStatus = orderService.GetOrderStatusByKey(Constants.OrderStatus.NotFulfilled);
            order.OrderStatus = orderStatus;
            orderService.Save(order, false); // sales listing table will still show "Fullfilled" if I set this to false.. 

    I'm just confused why the label wouldn't update without additional events being fired.. Or what is happening under the hood in the event that forces the label to update (why is it separate?). Screenshot!

    enter image description here

Please Sign in or register to post replies

Write your reply to: