4

I have been profiling some pages and after clearing cache there is a really slow response from: Locale/Currency

I am not too sure why it is taking so long. Here is the profiler entry:

locale currency profiler

Here is the time it takes:

enter image description here

3
  • 1
    Don't suppose you every figured this out and by any miracle remember what you did ?
    – Frank
    Commented Dec 11, 2017 at 13:48
  • No, unfortunately never managed to sort it.
    – tread
    Commented Dec 21, 2017 at 20:12
  • on which file you change this? Commented Aug 28, 2018 at 15:17

1 Answer 1

1

I came up with a solution for this in the end. I think the slow speeds stems from loading each locale in full every time it needs to get some simple information about the store.

I created my own method since all i need is the currency, symbol and URL of the store. This made things significantly quicker.

public function getSpeedyCurrencyData()
{
    $data = array();
    $codes = explode(',', Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_ALLOW));

    foreach ($codes as $code) {
        $data[$code]['url'] = Mage::helper('directory/url')->getSwitchCurrencyUrl(array('currency' => $code));
        $symbol = Zend_Locale_Data::getContent('en_GB', 'currencysymbol', $code);

        if (!$symbol) {
            $symbol = $code;
        }

        $data[$code]['symbol'] = $symbol;
    }

    return $data;
}

Your Answer

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

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