Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 650 posts 1529 karma points c-trib
    Apr 06, 2018 @ 12:13
    Rasmus Fjord
    0

    Updating a property on a finalized order, falls back to original value after iis restart

    Hey there I have an issue for something that I keep banging my head against.

    So i have a finalizedorder where i want to update a property upon.

    So I this:

     order.Properties.AddOrUpdate("music", "just some string");
    

    This property had a value before i just want to update it. Afterwards check the order again and the property value is actually updated. BUT then i do an iis restart(hitting web.config or whatever floats IIS boat) and then fetching the same order and the value on the property is back to what it was original. What is this voodoo :)

    TC v. 3.2.4 and Umbraco v. 7.5.14

  • Brian Lyk Larsen 19 posts 259 karma points
    Apr 09, 2018 @ 07:21
    Brian Lyk Larsen
    0

    Hi Rasmus,

    It looks like you might be missing a order.Save() after changing the property :)

  • Rasmus Fjord 650 posts 1529 karma points c-trib
    Apr 09, 2018 @ 07:23
    Rasmus Fjord
    0

    Is that normally needed when I call it specifically on the list?

  • Brian Lyk Larsen 19 posts 259 karma points
    Apr 09, 2018 @ 10:46
    Brian Lyk Larsen
    100

    The order is saved automatically when using the Razor or JavaScript API (TC.AddOrUpdateOrderProperties, TC.RemoveOrderLine, etc.), but you need to do it manually when making changes directly on the order object.

    This allows you to perform multiple changes in a single Save.

    order.PaymentInformation.PaymentMethodId = 1;
    order.Properties.AddOrUpdate("music", "just some string");
    order.Save();
    
  • Rasmus Fjord 650 posts 1529 karma points c-trib
    Apr 09, 2018 @ 10:49
    Rasmus Fjord
    0

    Thanks for explaing :)

Please Sign in or register to post replies

Write your reply to:

Draft