I want to add a courier tracking code, which is added to the order in the backoffice after the goods have been shipped, and then the customer can view this and also we can send an email.
Almost of this is fine and working nicely.
The problem I have is I can't see how to add a property to the order if I'm not currently in the basket process.
EG: I have
Order o = TC.GetOrder(1, new Guid(order));
TrackingCode.Text = o.Properties["tracking"];
and this works
the best I have so far to set it is
Order o = TC.SetCurrentOrder(1, new Guid(order)); CustomProperty c = TC.AddOrUpdateOrderProperty(1, "tracking", Button1.Text);
but this doesn't work, is there any way to go from an order object to set a property?
When an order is finalized you should not use TC anymore. TC is session based and and have rules for which orders can be as the current order. And a finalized order can never be set for the current order. So use TC to get the order, or use the OrderService.Instance (in TeaCommerce.Api) if you dont want it to be session based. Then just order.Properties.AddOrUpdate( parameters) and then order.Save(); That should be it.
setting order property
I want to add a courier tracking code, which is added to the order in the backoffice after the goods have been shipped, and then the customer can view this and also we can send an email.
Almost of this is fine and working nicely.
The problem I have is I can't see how to add a property to the order if I'm not currently in the basket process.
EG: I have
and this works
the best I have so far to set it is
but this doesn't work, is there any way to go from an order object to set a property?
Hi John.
When an order is finalized you should not use TC anymore. TC is session based and and have rules for which orders can be as the current order. And a finalized order can never be set for the current order. So use TC to get the order, or use the OrderService.Instance (in TeaCommerce.Api) if you dont want it to be session based. Then just order.Properties.AddOrUpdate( parameters) and then order.Save(); That should be it.
Kind regards
Anders
this seemed to be working, but actually it isn't
the test code i have is very simple:
After this when I step through the order has the custom property, but not when the order is reloaded. Any ideas what might be wrong here?
ha ha sorry fixed - should have read more carefully what you wrote above
now I have...
and this works a treat :)
is working on a reply...