Copied to clipboard

Flag this post as spam?

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


  • stephen 81 posts 122 karma points
    Feb 26, 2016 @ 13:05
    stephen
    0

    Updating CustomOrderlineProperty

    In this example I have updated 2 orderlines for each product by increasing the quantity for each.

    Within a loop:

    The call to TC.AddOrUpdateOrderLine is fine but trying to update the TeaCommerce_CustomOrderLineProperty seems to be problematic.

    I tried TC.AddOrUpdateOrderProperties(1, customPropertiesToAdd) but that didn't work.

    Tried TC.AddOrUpdateOrderProperty(1, "actualPrice", "40") but didn't work.

    Tried updateProperties1.Database.ExecuteSqlCommand(....) but only the 2nd out of the two loops updated.

    I tried Dispose() at the end of each command but this made no difference.

    If I added a condition to capture only the first index [0] in the loop, the property is updated but it appears that only the last command updates the table.

    How can I loop through each quantity update in the order and update the TeaCommerce_CustomOrderLineProperty for every orderline?

  • Rune Grønkjær 1371 posts 3102 karma points
    Feb 29, 2016 @ 07:18
    Rune Grønkjær
    0

    Hi Stephen,

    You might want to try making the changes directly on the order lise itself and then saving the order.

    You can go orderLine.Properties.AddOrUpdate(...) And then order.Save()

    That works for me. Also you might want to use som of the event hooks to be able to add the properties when the order line is first created: https://documentation.teacommerce.net/net-api/notification-center/

    /Rune - Tea Solutions

  • stephen 81 posts 122 karma points
    Mar 01, 2016 @ 11:14
    stephen
    0

    Hi

    thanks. I'll try this and get back.

    stephen

  • Rune Grønkjær 1371 posts 3102 karma points
    Mar 01, 2016 @ 11:21
    Rune Grønkjær
    0

    Cool. Please let us know if it gives you any trouble!

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft