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
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" );
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 :)
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.
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
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.
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
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
Godmorning :)
Thx boys, think ill just throw it in the DB directly.
is working on a reply...