Im doing some extending (yay ! :) ) but i cannot see how to add/remove a property to an order.
What ive done is fetched the order, and taken out the properties as a list of orderproperties. When i have manipulated this i wanna put it back in, but how is this done ? it says on o.properties that its read only.
Order o = TeaCommerce.Razor.TeaCommerce.GetOrder(); List<OrderProperty> props = o.Properties.ToList<OrderProperty>(); OrderProperty op = new OrderProperty("giftcard", AcceptedGiftCard.Id.ToString());
props.Add(op);
Adding a property through C#
Im doing some extending (yay ! :) ) but i cannot see how to add/remove a property to an order.
What ive done is fetched the order, and taken out the properties as a list of orderproperties. When i have manipulated this i wanna put it back in, but how is this done ? it says on o.properties that its read only.
Hi Rasmus,
First of all. In Tea Commerce 1 you cannot remove properties. You can just edit their value to an empty string.
To add a new order line programatically you need to use the AddProperty method on the order object. If the property already exists it will be updated.
You can also edit the value of an existing property by settings it's Value.
Remember to save the order in the end
/Rune
Arh okay. Thx Rune for a "quicky" answer :)
No prop(erty) ;)
is working on a reply...