PauloKruz Posted February 28, 2014 Share Posted February 28, 2014 Hi, I´m testing beta version 1.6.0.3 and all .js files are in the end of body. For this motive i have 2 questions? a ) Why are all .js files located in the end of body b ) Where in core files this function are? Because i need change it. I need call JQuery in header because i have some modules with errors because have functions calling JQuery before JQuery .js are loaded Error in Firebug: ReferenceError: jQuery is not defined. Link to comment Share on other sites More sharing options...
Gregory Roussac Posted March 3, 2014 Share Posted March 3, 2014 Hi, There are in the footer for performance reasons. Please use addJquery() and addJS() in your module http://doc.prestashop.com/pages/viewpage.action?pageId=11272250 Please consider adding a external script for your module using addJS() and not inline scripts. Your inline scripts should be defered at the end too if you did it in the template though, and after javascript queue. Can you please try a git version https://github.com/PrestaShop/PrestaShop/archive/1.6.zip ? maybe we can find why your scripts are not being deffered properly after jquery loading. Best regards 1 Link to comment Share on other sites More sharing options...
El Patron Posted March 5, 2014 Share Posted March 5, 2014 Hi, There are in the footer for performance reasons. Please use addJquery() and addJS() in your module http://doc.prestashop.com/pages/viewpage.action?pageId=11272250 Please consider adding a external script for your module using addJS() and not inline scripts. Your inline scripts should be defered at the end too if you did it in the template though, and after javascript queue. Can you please try a git version https://github.com/PrestaShop/PrestaShop/archive/1.6.zip ? maybe we can find why your scripts are not being deffered properly after jquery loading. Best regards very interesting topic, we are just getting to release new module for controlling which java loaded top bottom for 1.4|1.5. with 1.6 how do we specify java that needs to be loaded top via for example a module? Thanks in advance for your time. 1 Link to comment Share on other sites More sharing options...
Gregory Roussac Posted March 5, 2014 Share Posted March 5, 2014 Hi, I am sorry but for the moment this specification is not forecasted for 1.6. A module needs to use core functions, or if you do no want to use these functions, your inline scripts will be defered after the javascript stack and after Jquery loading. If you Include an other version of Jquery, this will be passed through a noconflict script too. Best regadrs 1 Link to comment Share on other sites More sharing options...
El Patron Posted March 5, 2014 Share Posted March 5, 2014 Hi, I am sorry but for the moment this specification is not forecasted for 1.6. A module needs to use core functions, or if you do no want to use these functions, your inline scripts will be defered after the javascript stack and after Jquery loading. If you Include an other version of Jquery, this will be passed through a noconflict script too. Best regadrs Thank you Gregory, I think what we are providing for 1.4-1.5 will be relevant in 1.6 as we now support async/defer options by java file. Thanks for keeping my hobby interesting...Keep up the good work. 2 Link to comment Share on other sites More sharing options...
Superbegood31 Posted March 21, 2014 Share Posted March 21, 2014 Hi,First, sorry for my bad english (I'm french) ...How can I include a js script in the HEAD tag?Because, my js script needs to be placed here.Thank you in advance.PS: I said that this is not a module Link to comment Share on other sites More sharing options...
El Patron Posted March 21, 2014 Share Posted March 21, 2014 themes/yourtheme/header.tpl between the <head> tags add your java script. Link to comment Share on other sites More sharing options...
Superbegood31 Posted March 21, 2014 Share Posted March 21, 2014 (edited) Ok but in 1.6 js script displaced in <body> tag..... Edited March 21, 2014 by SWITCHBOARD (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted March 21, 2014 Share Posted March 21, 2014 Ok but in 1.6 js script displaced in <body> tag..... yes, but I do not understand your question sorry. Link to comment Share on other sites More sharing options...
Superbegood31 Posted March 21, 2014 Share Posted March 21, 2014 Sorry, I can not formulate my question ...My script javascript must absolutely be placed in the head tag to make it work.Out since 1.6, these scripts are placed in the body tag.Can t be forced placement JavaScript script tag in the head?Thank you for your help. Link to comment Share on other sites More sharing options...
El Patron Posted March 21, 2014 Share Posted March 21, 2014 Sorry, I can not formulate my question ... My script javascript must absolutely be placed in the head tag to make it work. Out since 1.6, these scripts are placed in the body tag. Can t be forced placement JavaScript script tag in the head? Thank you for your help. Hi, yes simply edit the header.tpl in your theme folder and place there. You can either make a call like <script type="text/javascript" src="/pointer to .js file"></script> or, and this might be better if you tell ps in performance to Compress inline JavaScript in HTML and do something like this: <script type="text/javascript"> your java script </script> note the problem with placing in header.tpl file is that it will always be called even if that page does not require the .js to render. 1 Link to comment Share on other sites More sharing options...
Superbegood31 Posted March 21, 2014 Share Posted March 21, 2014 Thank you for your help.Problem solved: I had forgotten a piece of JS code .... 1 Link to comment Share on other sites More sharing options...
gabeshackle Posted May 9, 2014 Share Posted May 9, 2014 As of 1.6 ALL inline JavaScript is being pushed to the bottom of the page. Even those scripts being manually written in to a template file. This has been a major headache for me since upgrading. 3 Link to comment Share on other sites More sharing options...
val.zhi Posted May 17, 2014 Share Posted May 17, 2014 As of 1.6 ALL inline JavaScript is being pushed to the bottom of the page. Even those scripts being manually written in to a template file. This has been a major headache for me since upgrading. Как исправили? How to Fix? Link to comment Share on other sites More sharing options...
gabeshackle Posted May 17, 2014 Share Posted May 17, 2014 I posted a fix in a related forum topic using an override: http://www.prestashop.com/forums/topic/315798-no-html-allowed-in-blockcmsinfo/?do=findComment&comment=1666595 Link to comment Share on other sites More sharing options...
corint1 Posted December 18, 2014 Share Posted December 18, 2014 gabeshackle you are the best ...thank you for your solution . possible single one ... Link to comment Share on other sites More sharing options...
Recommended Posts