Small question about the .NET Api for TeaCommerce 2.0
I have a process where I want after the order is finalized, but before the confirmation mail is sent, I call a webservice, and place the result in the confirmation mail. It is important the order is payed for.
My first idea is just update one of the Order properties with TC.AddOrUpdateOrderProperty. And put that code in one of the events Order_OrderFinalizing or Order_OrderFinalized. However is changing order properties at that place ok?
If you use the OrderFinalized then you cant use TC.AddOrUpdateOrderProperty as TC is customer session specific and the order finalized is most called fomr a server to server callback from the payment gateway. Just use the order.Properties.AddOrUpdate method and then save the order. If you use the OrderFinalizing then you don't need to save the order - BUT the OrderFinalizing is called just before the order is saved and if you change properties, then the event for order properties wont be executed. Events are only called ones per order save cycle.
The OrderFinalized seems to work... but not always. Sometimes the property is not saved. I do call the order.Save() explicitly.
I doublechecked, the webservicecall returns the required content. I looked also in finalized-orders-xml-cache-1.xml file. Property is not visible there either.
Are you running Tea Commerce 2.0.0? There is a bug with the database fields for CustomOrderProperty and CustomOrderLineProperty - they are nvarchar(255) and should be ntext. It will be fixed in 2.0.1
I guess I get what's happening here... it looks like if I'm in the Order_OrderFinalizing or Order_OrderFinalized and do TC.AddOrUpdateOrderProperty. A new cart item is created and the properties are set on the next order.... I doublechecked again by reading this post carefully.
Now I see where I went wrong. I should have used order.Properties.AddOrUpdate. Next time I will try more patience and read better.
Btw: documentation portal: great stuff over there!!!
Finalizing order
Hi,
Small question about the .NET Api for TeaCommerce 2.0
I have a process where I want after the order is finalized, but before the confirmation mail is sent, I call a webservice, and place the result in the confirmation mail. It is important the order is payed for.
My first idea is just update one of the Order properties with TC.AddOrUpdateOrderProperty. And put that code in one of the events Order_OrderFinalizing or Order_OrderFinalized. However is changing order properties at that place ok?
Merijn
If you use the OrderFinalized then you cant use TC.AddOrUpdateOrderProperty as TC is customer session specific and the order finalized is most called fomr a server to server callback from the payment gateway. Just use the order.Properties.AddOrUpdate method and then save the order. If you use the OrderFinalizing then you don't need to save the order - BUT the OrderFinalizing is called just before the order is saved and if you change properties, then the event for order properties wont be executed. Events are only called ones per order save cycle.
Kind regards
Anders
Hi Anders,
The OrderFinalized seems to work... but not always. Sometimes the property is not saved. I do call the order.Save() explicitly.
I doublechecked, the webservicecall returns the required content. I looked also in finalized-orders-xml-cache-1.xml file. Property is not visible there either.
Any idea?
Cheers,
Merijn
Are you running Tea Commerce 2.0.0? There is a bug with the database fields for CustomOrderProperty and CustomOrderLineProperty - they are nvarchar(255) and should be ntext. It will be fixed in 2.0.1
Kind regards
Anders
Were at 2.0.0. Currently running 2.1.1.
I guess I get what's happening here... it looks like if I'm in the Order_OrderFinalizing or Order_OrderFinalized and do TC.AddOrUpdateOrderProperty. A new cart item is created and the properties are set on the next order.... I doublechecked again by reading this post carefully.
Now I see where I went wrong. I should have used order.Properties.AddOrUpdate. Next time I will try more patience and read better.
Btw: documentation portal: great stuff over there!!!
is working on a reply...