js中未捕获的fx错误

时间:2014-08-25 08:46:25

标签: javascript plugins

我遇到了woocommerce-currency-converter-widget插件的问题

  

"得到了未捕获的fx错误"

。当我试图在开发者控制台中更改货币时。请指导我如何解决此错误。货币小部件位于主页滑块上方的左上角。

  

我的网站网址:vandvshop.com/production /

我遇到麻烦请帮帮我。

1 个答案:

答案 0 :(得分:0)

尚未完全回答,但是解决问题的方法。

UPDATE:
Analyzed [X]
Found Code throwing error [X]
Feedback from OP []
Resolved[]

按任何货币之前的控制台输出。

woocommerce_current_currency=; PHPSESSID=bbd72ed061219517d131970655c5f259; _ga=GA1.2.1963075693.1408956497

我之后做的步骤:

第一次点击欧元图标

控制台输出:

woocommerce_current_currency=; PHPSESSID=bbd72ed061219517d131970655c5f259; _ga=GA1.2.1963075693.1408956497 

没有任何改变

第二次点击enter image description here

控制台输出:

woocommerce_current_currency=EUR; PHPSESSID=bbd72ed061219517d131970655c5f259; _ga=GA1.2.1963075693.1408956497 

好的,现在你可以看到current_currency改为EUR

第三次点击美元

控制台输出:

Uncaught fx error money.min.js?ver=0.1.3:2
b.convert money.min.js?ver=0.1.3:2
c.to money.min.js?ver=0.1.3:2
(anonymous function) conversion.min.js?ver=1.2.3:1
n.extend.each jquery.js?ver=1.10.2:2
n.fn.n.each jquery.js?ver=1.10.2:2
u conversion.min.js?ver=1.2.3:1
(anonymous function) conversion.min.js?ver=1.2.3:1
n.event.dispatch jquery.js?ver=1.10.2:3
r.handle

结论:不知何故,它有转换货币的问题

编辑:下面是抛出错误的代码,可能有帮助。

// Returns the exchange rate to `target` currency from `base` currency
    var getRate = function(to, from) {
        // Save bytes in minified version
        var rates = fx.rates;

        // Make sure the base rate is in the rates object:
        rates[fx.base] = 1;


    //////////// This is the part throwing the error!  ////////////
 //////////// Throw an error if either rate isn't in the rates array //////////// 



if ( !rates[to] || !rates[from] ) throw "fx error"; 


     //////////// //////////// //////////// //////////// //////////// ////////////


        // If `from` currency === fx.base, return the basic exchange rate for the `to` currency
        if ( from === fx.base ) {
            return rates[to];
        }

        // If `to` currency === fx.base, return the basic inverse rate of the `from` currency
        if ( to === fx.base ) {
            return 1 / rates[from];
        }

        // Otherwise, return the `to` rate multipled by the inverse of the `from` rate to get the
        // relative exchange rate between the two currencies
        return rates[to] * (1 / rates[from]);
    };