5

This is happening only when I save, for a store view, the Romanian locale. On this shop, the allowed currencies are US$, Romanian Leu and EURO. I set Currency Rates for each allowed currency: if US$ is default currency then I have a specific currency rate, if Romanian Leu is default currency another specific currency rate and exactly the same thing for EURO.

I searched on google about this error but the only solution that I founded was to clear var/cache and var/session ... Well, that isn't a solution.

a:5:{i:0;s:24:"Currency 'USD' not found";i:1;s:5065:"#0 /app/code/core/Mage/Core/Model/Locale.php(576): Zend_Currency->__construct('USD', Object(Zend_Locale))
/app/code/core/Mage/Directory/Model/Currency.php(233): Mage_Core_Model_Locale->currency('RON')
/app/code/core/Mage/Directory/Model/Currency.php(238): Mage_Directory_Model_Currency->formatTxt(0)
/app/code/core/Mage/Core/Model/Locale.php(682): Mage_Directory_Model_Currency->getOutputFormat()
/app/code/core/Mage/Catalog/Block/Product/View.php(168): Mage_Core_Model_Locale->getJsPriceFormat()
/app/design/frontend/magento-boilerplate/default/template/catalog/product/view.phtml(69): Mage_Catalog_Block_Product_View->getJsonConfig()
/app/code/core/Mage/Core/Block/Template.php(241): include('/home/mediaswit...')
/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/magent...')
/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('content', true)
/app/design/frontend/magento-boilerplate/default/template/page/2columns-right.phtml(51): Mage_Core_Block_Abstract->getChildHtml('content')
/app/code/core/Mage/Core/Block/Template.php(241): include('/home/mediaswit...')
/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/magent...')
app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()
/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route')
/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route')
/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Cms_IndexController->noRouteAction()
/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('noRoute')
/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
/app/Mage.php(683): Mage_Core_Model_App->run(Array)
/index.php(87): Mage::run('', 'store')


Please help. Thank you.

2
  • what version of magento are you using? Jan 16, 2014 at 10:13
  • Magento ver. 1.7.0.2
    – Eugen
    Jan 16, 2014 at 10:14

1 Answer 1

2

Ok so I am not sure if this is the bug but if you compare the Magento 1.8 and Magento 1.7 versions of the function currency in Mage_Core_Model_Local you will notice a reference to a bug with Zend_Currency

Magento 1.7: Mage_Core_Model_Local->currency

/**
 * Create Zend_Currency object for current locale
 *
 * @param   string $currency
 * @return  Zend_Currency
 */
public function currency($currency)
{
    Varien_Profiler::start('locale/currency');
    if (!isset(self::$_currencyCache[$this->getLocaleCode()][$currency])) {
        try {
            $currencyObject = new Zend_Currency($currency, $this->getLocale());
        } catch (Exception $e) {
            $currencyObject = new Zend_Currency($this->getCurrency(), $this->getLocale());
            $options = array(
                    'name'      => $currency,
                    'currency'  => $currency,
                    'symbol'    => $currency
            );
            $currencyObject->setFormat($options);
        }

        self::$_currencyCache[$this->getLocaleCode()][$currency] = $currencyObject;
    }
    Varien_Profiler::stop('locale/currency');
    return self::$_currencyCache[$this->getLocaleCode()][$currency];
}

Magento 1.8: Mage_Core_Model_Local->currency

/**
 * Create Zend_Currency object for current locale
 *
 * @param   string $currency
 * @return  Zend_Currency
 */
public function currency($currency)
{
    Varien_Profiler::start('locale/currency');
    if (!isset(self::$_currencyCache[$this->getLocaleCode()][$currency])) {
        $options = array();
        try {
            $currencyObject = new Zend_Currency($currency, $this->getLocale());
        } catch (Exception $e) {
            /**
             * catch specific exceptions like "Currency 'USD' not found"
             * - back end falls with specific locals as Malaysia and etc.
             *
             * as we can see from Zend framework ticket
             * http://framework.zend.com/issues/browse/ZF-10038
             * zend team is not going to change it behaviour in the near time
             */
            $currencyObject = new Zend_Currency($currency);
            $options['name'] = $currency;
            $options['currency'] = $currency;
            $options['symbol'] = $currency;
        }

        $options = new Varien_Object($options);
        Mage::dispatchEvent('currency_display_options_forming', array(
            'currency_options' => $options,
            'base_code' => $currency
        ));

        $currencyObject->setFormat($options->toArray());
        self::$_currencyCache[$this->getLocaleCode()][$currency] = $currencyObject;
    }
    Varien_Profiler::stop('locale/currency');
    return self::$_currencyCache[$this->getLocaleCode()][$currency];
}

My suggestion would be to try updating the try catch to match that of Magento 1.8 (I know this is not the best solution and obviously I would not suggest editing the core files but adding a rewrite)

0

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.