Jump to content

Making JQuery to load first in admin panel

Recommended Posts


I don't know how this happened but suddenly the admin of my Prestashop started to show errors. The loading icon in admin up in the left continues to spin even after the page is fully loaded. 
I the inspector I see the following errors:

jquery.ui.slider.min.js:4 Uncaught TypeError: Cannot read property 'mouse' of undefined
    at jquery.ui.slider.min.js:4
    at jquery.ui.slider.min.js:4
(anonymous) @ jquery.ui.slider.min.js:4
(anonymous) @ jquery.ui.slider.min.js:4
admin-theme.js:300 Uncaught TypeError: $(...).dropdown is not a function
    at HTMLDocument.<anonymous> (admin-theme.js:300)
    at j (VM7891 jquery-1.11.0.min.js:2)
    at Object.fireWith [as resolveWith] (VM7891 jquery-1.11.0.min.js:2)
    at Function.ready (VM7891 jquery-1.11.0.min.js:2)
    at HTMLDocument.K (VM7891 jquery-1.11.0.min.js:2)

So it seems that the Jquery is loaded after some modules/scripts that require it.
I don't know how to make the jquery and jquire ui to load before those modules.

I tried to edit admin/themes/default/template/header.tpl and put right after the </title> the code that loads jquery and jquery ui:

<script type="text/javascript" src="/js/jquery/jquery-1.11.0.min.js" defer></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js" defer></script>

In the HTML source code it is shown exactly where it is but in the inspector/dom it still remains below some .js calls:

<script src="/admin3/themes/default/js/vendor/enquire.min.js"></script>
<script src="/admin3/themes/default/js/admin-theme.js"></script>
<script type="text/javascript" src="/js/jquery/jquery-1.11.0.min.js" defer=""></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js" defer=""></script>

I'm starting to feel desperate and will appreciate if anyone can give me an advise with this.

Many thanks in advance!

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More