0

has anyone figured out a way to display the fedex tracking screen in the correct timezones? aka, not UTC.

I've set the Magento timezone and the Server Timezones correctly. It's just the fedex tracking link that gives UTC dates and times, without warning on the frontend and the backend.

1 Answer 1

2

As it happens Mage overrides the timezone set in PHP and forces it to UTC in app/Mage.php. This is intended so that everything written to the DB is in UTC. The problem comes when the localization does not take into account the timezones of the places it talks about.

The work around to display all times in your store's timezone is to go into the getTracking method of core/Mage/Usa/Model/Shipping/Fedex.php, although this should work for anything that implements Mage_Shipping_Model_Carrier_Interface. and replace

$this->_getXMLTracking($tracking);

With

            $og_tz = date_default_timezone_get();
            $store_tz = Mage::getStoreConfig('general/locale/timezone');
            date_default_timezone_set($store_tz);
            $this->_getXMLTracking($tracking);
            date_default_timezone_set($og_tz);

This will display the time in the store's timezone, which will not be exactly the same as the Fedex's tracking page, which by default displays times local to each stop.

I should mention that these changes should be in the app/code/local repository to preserve some upgradeability.

Hope someone finds this useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.