I have an unusual and bespoke subscriptions senario which involves linking email addresses to subscription products by adding the email address as an orderline property.
Now it is possible that a member might log in and change their email address. When this happens I would want to update all the corresponding orderline properties for existing orders with the new email address.
I could use GetFinalizedOrdersXmlForMember, traverse their orders and update each one. I thought it might be more efficient however to update the database table directly. If I did that though I think I'd need to force an orders XML refresh.
Can this be done programmatically an is it wise to do it this way at all?
In Tea Commerce we only save the order specific details that change. So you could load the order and change the orderline details and save the order. This will update the xml. Would that be okay?
I can see that the static method UpdateXmlCache on the Order class is currently internal. So we will have to open it up for you if you want to do the above. I cannot say if it will be faster than saving single orders, but it might be in some cases. The UpdateXmlCache method will grab ALL orders from the database and create a new xml cache from them. This could potentially be a lot of orders and take some time.
Programmatically refreshing the orders xml
I have an unusual and bespoke subscriptions senario which involves linking email addresses to subscription products by adding the email address as an orderline property.
Now it is possible that a member might log in and change their email address. When this happens I would want to update all the corresponding orderline properties for existing orders with the new email address.
I could use GetFinalizedOrdersXmlForMember, traverse their orders and update each one.
I thought it might be more efficient however to update the database table directly.
If I did that though I think I'd need to force an orders XML refresh.
Can this be done programmatically an is it wise to do it this way at all?
Regards,
Matt
Hi Matt
In Tea Commerce we only save the order specific details that change. So you could load the order and change the orderline details and save the order. This will update the xml. Would that be okay?
Kind regards
Anders
Hi Matt,
The XML will update itself when you save an order in the Tea Commerce .NET API. So both the database and xml will be updated at the same time.
So use Order.GetOrder() when you traverse the members orders, change the order and save it. That should do the trick nicely.
/Rune
Hi guys,
I am currently using the order object and saving as you suggest and in this case I will probbaly continue to to do so.
I was wondering though if there were a lot of records it would be more efficient to update the table directly with something like:
Then refresh the xml.
Regards,
Matt
How are you doing with this?
I can see that the static method UpdateXmlCache on the Order class is currently internal. So we will have to open it up for you if you want to do the above. I cannot say if it will be faster than saving single orders, but it might be in some cases. The UpdateXmlCache method will grab ALL orders from the database and create a new xml cache from them. This could potentially be a lot of orders and take some time.
/Rune
Hi Rune,
I've decided that using the available order objects is OK for what I'm trying to do so will stick with it.
The use of UpdateXmlCache could be interesting and i'll keep it in mind for the future and possibly someone else may have a use for it then too.
Thanks,
Matt
is working on a reply...