Copied to clipboard

Flag this post as spam?

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


  • Kris Bloom 1 post 71 karma points
    May 21, 2021 @ 18:57
    Kris Bloom
    0

    Can't edit order - Weird

    I am just trying out Vendr and i am having a weird thing happen...

    Order has a totalcount of 1 and the new property. Order2 has a count of 0 and no properties.. How is this possible?

    Here is the code...

    var store = CurrentPage.GetStore();
                using (var uow = _unitOfWorkProvider.Create())
                {
    
    
                    var order = _sessionManager.GetOrCreateCurrentOrder(store.Id)
                        .AsWritable(uow)
                        .SetProperty("t4estprop",new PropertyValue("test"))
                        .AddProduct(AddToCartModel.ProductReference, AddToCartModel.Quantity);
    
    
                    uow.Complete();
                    //var id = order.Id.ToString();
    
    
    
    
                }
                var order2 = _sessionManager.GetCurrentOrder(store.Id);
    
  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 22, 2021 @ 05:51
    Matt Brailsford
    1

    Hi Kris,

    It’s because you haven’t saved the order after you’ve made the changes so the changes are reverted when the unit of work completes. You need to call orderService.SaveOrder(order); before you complete your uow.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft