Jump to content

[solved] Move JS to the END not works properly


Recommended Posts

Hello guys,

Have some problem with Move JS to the END:

 

Prestashop 1.6.0.9, my custom theme based on default, of course some custom JS.

 

1) Condition one:

Move JS to the END turned OFF:

Language and currencies popups closed instantly after opening, product carousels based on bx.slider not working properly, attributes of product on product page not changing (for example price and photos depending on color selected). and more little problems.

 

So, by default I turned Move JS to the END to ON.

2) Condition two:

Move JS to the END ON.

All problems, that i wrote before - solved. All works fine. First problem I faced - in address page you can not see states. Of course in BO all is good. JS just don't deleete unvisible class, and also don't load liast of states in selector (if I remove display:none in firebug - selector apeears, but it is empty).

 

When I turn Move JS to the end OFF - states works properly.

 

I tested it in default theme - and all is ok.

 

My first thoughts - that it is because of ORDER of JS files including... So it tested it... There are was some custom JS, and also jquery from google api included in my theme, so I removed it, and it NOT helped.

 

I reached IDENTICAL order of files with Move JS to the end turned ON and OFF. - But problems in both conditions still here. Also I reaches turned on my custom modules and reaches order like default theme - but not result too. Here is order

<script type="text/javascript" src="/demo/test2/js/jquery/jquery-1.11.0.min.js"></script>
        <script type="text/javascript" src="/demo/test2/js/jquery/jquery-migrate-1.2.1.min.js"></script>
        <script type="text/javascript" src="/demo/test2/js/jquery/plugins/jquery.easing.js"></script>
        <script type="text/javascript" src="/demo/test2/js/tools.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/global.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/autoload/10-bootstrap.min.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/autoload/15-jquery.total-storage.min.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/autoload/15-jquery.uniform-modified.js"></script>
        <script type="text/javascript" src="/demo/test2/js/jquery/plugins/fancybox/jquery.fancybox.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/products-comparison.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/modules/blockcart/ajax-cart.js"></script>
        <script type="text/javascript" src="/demo/test2/js/jquery/plugins/jquery.scrollTo.js"></script>
        <script type="text/javascript" src="/demo/test2/js/jquery/plugins/jquery.serialScroll.js"></script>
        <script type="text/javascript" src="/demo/test2/js/jquery/plugins/bxslider/jquery.bxslider.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/tools/treeManagement.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/modules/blocknewsletter/blocknewsletter.js"></script>
        <script type="text/javascript" src="/demo/test2/js/jquery/plugins/autocomplete/jquery.autocomplete.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/modules/blocksearch/blocksearch.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/modules/blockwishlist/js/ajax-wishlist.js"></script>
        <script type="text/javascript" src="/demo/test2/modules/royfacebookblock/royfacebookblock.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/modules/blocktopmenu/js/hoverIntent.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/modules/blocktopmenu/js/superfish-modified.js"></script>
        <script type="text/javascript" src="/demo/test2/themes/modez/js/modules/blocktopmenu/js/blocktopmenu.js"></script>
        <script type="text/javascript" src="http://roythemes.com/demo/test2/themes/modez/js/modez-mainscript.js"></script>

Fun fact: Dev panel on any browser doesn't show any errors, warning or notices. When I clicking on all these problem elements too.

 

So I need states to work when Move JS to the END ON or all other problems (condition one) works properly when it OFF.

 

I know, that before 1.6.0.7 all JS files was forced pushed to the END. And i think all was works fine.

 

Sorry for huge post. Just want to describe it for you.

 

Here is an urls to see: 

Move JS to the END OFF here. 

http://roythemes.com/demo/test2/en/

 

And here it is ON:

http://roythemes.com/demo/test3/en/

 

I just don't know what I can do with it.  Need your help, please. Thank you. 

Link to comment
Share on other sites

to be very honest?  you need a quality theme that supports javascript bottom.  my two cents...I do have module that allows you to select which javascript (see JavaPro) loads top and which goes bottom, it's designed for all 1.5 shops but also for 1.6 shops whose theme/modules are non-1.6 compliant.  When used with 1.6 tell PrestaShop in back office to load top, then configure javascript position using module.  good luck!

Link to comment
Share on other sites

to be very honest?  you need a quality theme that supports javascript bottom.  my two cents...I do have module that allows you to select which javascript (see JavaPro) loads top and which goes bottom, it's designed for all 1.5 shops but also for 1.6 shops whose theme/modules are non-1.6 compliant.  When used with 1.6 tell PrestaShop in back office to load top, then configure javascript position using module.  good luck!

 

Hello, thank you for advice. But I must reach it without third-party module. My theme is high quality theme, that supports javascript at the bottom. As i said before, all works great with Move JS to the END turned ON. I faced the problem with states. Described it in first post (condition two). If somebody have any ideas - it will be very good.

Link to comment
Share on other sites

no, problem was with any country. I have no problem now too. It seems that disabling of some module or js include helps. I wrote what it was later. Thank you for your time!

 

yes, please let us know...javascript bottom is the 'must have' feature in 1.6....makes your above the fold render go zoom!

Link to comment
Share on other sites

so..... maybe it is some kind of white magic.. (ny will be soon)  :)  But I return almost all to my original code and it works great without any problems with Move JS to the end ON. I'm not really sure what it was. But remeber some easy rules: if you include some js files in your header.tpl - include it all after prestashop include code. First all types of jquery, second all prestashop js, next theme js, next your custom js.

 

I have not properly work of bx.slider (used by default in prestashop), so I downloaded last version of it from official source - and included it.... two times. Now it's included only one time. Maybe it was somehow harm work of shop.

 

Anyway states and other works fine. Thank you.

  • Like 1
Link to comment
Share on other sites

Hello everyone,

I do not know if it is the correct place to put my questions. I apologize to RoyVelvet to take advantage of your topic, but as this is an issue with javascript ... I hope you don't mind.


When I enable the option "Move JavaScript to the end" in preferences -> performance, all my home page products disappear. Also the block categories in the left column is completely open showing all categories and subcategories. Usually this block shows only the main categories and we open the categories and subcategories according to the need.
I use the version 1609 with the defaultbootstrap theme. I have been updating prestashop since 1.5.
Does anyone have any idea what may be causing this error?
Any help will be very welcome!
Thank you


 

Link to comment
Share on other sites

Hello everyone,

 

I do not know if it is the correct place to put my questions. I apologize to RoyVelvet to take advantage of your topic, but as this is an issue with javascript ... I hope you don't mind.

 

When I enable the option "Move JavaScript to the end" in preferences -> performance, all my home page products disappear. Also the block categories in the left column is completely open showing all categories and subcategories. Usually this block shows only the main categories and we open the categories and subcategories according to the need.

I use the version 1609 with the defaultbootstrap theme. I have been updating prestashop since 1.5.

Does anyone have any idea what may be causing this error?

Any help will be very welcome!

Thank you

 

 

 

Please open new topic for best community review.  Thanks

Link to comment
Share on other sites

×
×
  • Create New...