Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Jul 11, 2013 @ 11:37
    Rasmus Fjord
    0

    Overwriting order dates properties because of azure UTC (1.4)

    Hey Guys ;)

    So at the moment we are running a customers shop on Azure and its running great, but because azure runs on UTC time so when an order is placed the time is about 2 hours early compared to danish time.

    So i thought i would just create a webshopevent to handle it

      private void WebshopEvents_AfterOrderFinalized(Order order, Data.Payment.CallbackInfo callback)

            {

                //Handle it

                order.Save();

            }

     

    But the date values are readonly on the order obj, do you see a way to handle this ?

    Its in the pipeline to replace 1.4 with 2.x in a few months but thats not now.

     

  • Rune Grønkjær 1372 posts 3103 karma points
    Jul 11, 2013 @ 19:49
    Rune Grønkjær
    0

    Yeah, in Tea Commerce 2 you could easily do that. But not on Tea Commerce 1.

    Why not save your dates as order properties? I know it's a string and you would have to parse it when you need it, but it would work just fine

    /Rune

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Jul 12, 2013 @ 08:28
    Rasmus Fjord
    0

    Hey rune thx for your quick answer as always :)

     

    Yeah i thought about saving as a property but the issue is that it will still show wrongly in the order overview since we cannot change it. 

  • Rune Grønkjær 1372 posts 3103 karma points
    Jul 12, 2013 @ 10:05
    Rune Grønkjær
    0

    You can change the date either when you save it to the property or just when you show the date in the order overview. I have done something like it when displaying dates from a rss feed where the date was in a different format. Maybe you can rewrite this a bit to get something out of it:

    DateTime date = theWrongDate;
    TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById( "Eastern Standard Time" );
    TimeZoneInfo europeanZone = TimeZoneInfo.FindSystemTimeZoneById( "W. Europe Standard Time" );

    DateTime utcDate = TimeZoneInfo.ConvertTimeToUtc( date, easternZone );
    DateTime dkdate = TimeZoneInfo.ConvertTimeFromUtc( date, europeanZone );

    /Rune

  • Anders Burla 2560 posts 8256 karma points
    Jul 14, 2013 @ 01:49
    Anders Burla
    100

    Hi Rasmus

    You can also overwrite the dates directly in the database and the make sure the xml cache is regenerated by saving the order. That should also do the trick :)

    Kind regards
    Anders 

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Jul 15, 2013 @ 08:07
    Rasmus Fjord
    0

    Godmorning :)

    Thx boys, think ill just throw it in the DB directly.

Please Sign in or register to post replies

Write your reply to:

Draft