-1

我不是 Magento 开发人员,但我被要求解决 Magento 网站的问题。我不知道我在用 Magento 做什么,所以我希望这里有人能指出我正确的方向。

该站点正在生成 javascript 错误,所有这些错误似乎都来自原型 javascript 库。

这是我看到的那种错误。

var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail'); "
output: anonymous function, error on varienform.initialize , 
error on      validadtion.initialize

该网站位于 URLhttp://loja.viavini.com.br/如果您想查看“正在运行”的错误。

我真的不知道从哪里开始,所以任何帮助表示赞赏。

4

2 回答 2

1

除了 Alan Storm 在这里提到的还有 2 个错误:

1)您正在调用 $(document).ready(function() {})第 2592 行 -$必须更改为jQuery.

2)您也在 jQuery("#pikame").PikaChoose({})第 3778 行调用 - 但您jQuery在调用 pikachoose.js 之后重新定义(通过在第 67 行附近调用相同的 jQuery 文件) - 这将覆盖之前的jQuery内容并使用它 "removing" PikaChoose

于 2013-05-07T22:59:35.903 回答
0

You don't need to know a thing about Magento to handle your problem.

The site you linked is using both jQuery and Prototype. If you look at the value of $ in the console, it's the main jQuery function.

> $
function (e,n){return new x.fn.init(e,n,t)}

I can't say for sure why that is, but my first area of investigation would be the multiple jQuery libraries you're including. Near the top of the page you use

<script type="text/javascript" src="http://loja.viavini.com.br/js/my_ibanner/jquery.js"></script>
<script type="text/javascript" src="http://loja.viavini.com.br/js/my_ibanner/jquery.noconflict.js"></script>

which would normally be enough to have jQuery and prototype behave together. However, later in the page you include another jQuery library

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>

The second jQuery redefines $, but doesn't re-do a call to jQuery.noConflict(). This means prototype and jQuery can't co-exist on your page anymore.

The right thing to do would be determine which version of jQuery your site needs, and ensure it only includes that single library, followed by a call to the no conflict method.

The expedient thing to do would be find the insertion of the 2.0.0 jQuery, and add a no-conflict call after that — either in script block, pr via the same <script type="text/javascript" src="http://loja.viavini.com.br/js/my_ibanner/jquery.noconflict.js"></script> tag.

于 2013-05-07T21:28:24.270 回答