Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matt Taylor 873 posts 2086 karma points
    Mar 28, 2012 @ 17:05
    Matt Taylor
    0

    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

  • Anders Burla 2560 posts 8256 karma points
    Mar 28, 2012 @ 18:02
    Anders Burla
    0

    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

  • Rune Grønkjær 1372 posts 3103 karma points
    Mar 28, 2012 @ 19:19
    Rune Grønkjær
    0

    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

  • Matt Taylor 873 posts 2086 karma points
    Mar 29, 2012 @ 10:51
    Matt Taylor
    0

    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:

    UPDATE TeaCommerce_OrderLineProperty SET DataNtext = 'x' WHERE DataNtext= 'y' AND Alias = 'myAlias'

    Then refresh the xml.

    Regards,

    Matt

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 01, 2012 @ 12:54
    Rune Grønkjær
    0

    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

  • Matt Taylor 873 posts 2086 karma points
    Apr 01, 2012 @ 13:02
    Matt Taylor
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft