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?
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?
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
Hi
thanks. I'll try this and get back.
stephen
Cool. Please let us know if it gives you any trouble!
/Rune
is working on a reply...