ysco Posted July 6, 2014 Share Posted July 6, 2014 (edited) Hello All, I have some time ago updated my store from 1.5.x to 1.6.0.6 and is running without problems. Now i have updated my Test server that from 1.6.0.6. to version 1.6.0.8 and i noticed under performance under the part "combine/cache options" there you have a option called "Move JavaScript to the end" I have seen that for the first time so i have read that this is a new option for PS 1.6.x but this is the first time i have seen this option. My question is how do i get this option in my current PS 1.6.0.6 version as it is not shown there. Hope someone can help me in the right direction. Thanks. ysco.. Edited July 6, 2014 by ysco (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted July 6, 2014 Share Posted July 6, 2014 Hi, you will need to upgrade for that native option. Note this is the default behavior for 1.6.0.6, i.e. you JavaScript is being loaded bottom. Link to comment Share on other sites More sharing options...
ysco Posted July 6, 2014 Author Share Posted July 6, 2014 Hello EI Patron, Thanks for your reply. So in 1.6.0.6 this is also working already by default but in new ps 1.6.0.8. they have added a option to set it ON or OFF as i understand it correct Thanks for letting me know. Best regards, ysco.. Link to comment Share on other sites More sharing options...
El Patron Posted July 6, 2014 Share Posted July 6, 2014 Hi ysco, visit your shop, any page, then right click-->view source. scroll to the bottom, this is where you should find the bulk of your JavaScript being loaded. Loading at the bottom is the recommended way to speed up 'above the fold' page render. In 1.6.0.7 they added the capability to load at the top, I suppose this was done because theme developers have not caught up with best in class practices (sort of like herding cats). Link to comment Share on other sites More sharing options...
ysco Posted July 6, 2014 Author Share Posted July 6, 2014 Hello EI Patron, Thanks for explaining this, indeed i checked and all java is at bottom So all works correct. Thanks again. Best regards, ysco.. 1 Link to comment Share on other sites More sharing options...
Ron morales Posted August 5, 2014 Share Posted August 5, 2014 if it works, but in my case if I want to load in the header to display undeployed my top menu with 1.6.06 and not update because I have to work again in my template, and I have no way Link to comment Share on other sites More sharing options...
El Patron Posted August 5, 2014 Share Posted August 5, 2014 if it works, but in my case if I want to load in the header to display undeployed my top menu with 1.6.06 and not update because I have to work again in my template, and I have no way ps supports from 1.6.0.7 and higher, load top, but it does not support 'some' top 'some' bottom. it is all or nothing. I hope I understand your question well enough to add this comment. Link to comment Share on other sites More sharing options...
Ron morales Posted August 5, 2014 Share Posted August 5, 2014 (edited) there is no way to fix it? update is much work, the compatibility of the template, and tried several solutions to no run Edited August 5, 2014 by Ron morales (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted August 5, 2014 Share Posted August 5, 2014 there is no way to fix it? update is much work, the compatibility of the template, and tried several solutions to no run you need to add a javascript to run top in 1.6.0.6 yes? Link to comment Share on other sites More sharing options...
Ron morales Posted August 5, 2014 Share Posted August 5, 2014 Yes Link to comment Share on other sites More sharing options...
El Patron Posted August 5, 2014 Share Posted August 5, 2014 Yes http://www.prestashop.com/forums/topic/315798-no-html-allowed-in-blockcmsinfo/?p=1666595 please post there for any questions... 1 Link to comment Share on other sites More sharing options...
Ron morales Posted August 5, 2014 Share Posted August 5, 2014 Yes i test this solution and not work for me, and instruction not is clear, thanks for the reply Link to comment Share on other sites More sharing options...
Ron morales Posted August 6, 2014 Share Posted August 6, 2014 (edited) http://www.prestashop.com/forums/topic/315798-no-html-allowed-in-blockcmsinfo/?p=1666595 please post there for any questions... I generate this file: media.php and Paste the file to override/classes/Media.php, cache/class_index.php delete? or add 'Media' => array ( 'path' => 'override/classes/Media.php', 'type' => 'class', ) in <head><script src="/themes/mytheme/js/myscript.js" data-keepinline="true"></script></head> correct? Edited August 6, 2014 by Ron morales (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted August 6, 2014 Share Posted August 6, 2014 I generate this file: media.php and Paste the file to override/classes/Media.php, cache/class_index.php delete? or add 'Media' => array ( 'path' => 'override/classes/Media.php', 'type' => 'class', ) in <head><script src="/themes/mytheme/js/myscript.js" data-keepinline="true"></script></head> correct? I am not sure of your question, so I take a guess. after you create the overrride, then delete file cache/class_index.php Link to comment Share on other sites More sharing options...
Ron morales Posted August 6, 2014 Share Posted August 6, 2014 I am not sure of your question, so I take a guess. after you create the overrride, then delete file cache/class_index.php in the comment https://gist.github.com/hereswhatidid/8c8edef106ee95138b03 To install : 1. Paste the file to override/classes/Media.php 2. In cache/class_index.php find and complete this block :<----------------paste in this file--- 'Media' => array ( 'path' => 'override/classes/Media.php', 'type' => 'class', ) Link to comment Share on other sites More sharing options...
El Patron Posted August 6, 2014 Share Posted August 6, 2014 in the comment https://gist.github.com/hereswhatidid/8c8edef106ee95138b03 To install : 1. Paste the file to override/classes/Media.php 2. In cache/class_index.php find and complete this block :<----------------paste in this file--- 'Media' => array ( 'path' => 'override/classes/Media.php', 'type' => 'class', ) 1. create new file, Paste the file into file, then save as Media.php and ftp to remote server here: override/classes/Media.php 2. delete file cache/class_index.php (this will automatically add the 'Media' => array to cache/class_index.php Link to comment Share on other sites More sharing options...
Ron morales Posted August 6, 2014 Share Posted August 6, 2014 (edited) delete the file, and a new one is created with the line 'Media' => array ( 'path' => 'override/classes/media.php', 'type' => 'Class', ), Edited August 6, 2014 by Ron morales (see edit history) 1 Link to comment Share on other sites More sharing options...
Ron morales Posted August 6, 2014 Share Posted August 6, 2014 1. create new file, Paste the file into file, then save as Media.php and ftp to remote server here: override/classes/Media.php 2. delete file cache/class_index.php (this will automatically add the 'Media' => array to cache/class_index.php i test but not work Link to comment Share on other sites More sharing options...
Ron morales Posted August 6, 2014 Share Posted August 6, 2014 This call work for me <script type="text/javascript" data-keepinline="true"> // this script will remain here when rendered alert( "hello!" ); </script> when call <script src="http://www.test/themes/default-bootstrap/js/modules/blocktopmenu/js/hoverIntent.js"></script> add to end body 1 Link to comment Share on other sites More sharing options...
El Patron Posted August 6, 2014 Share Posted August 6, 2014 This call work for me <script type="text/javascript" data-keepinline="true"> // this script will remain here when rendered alert( "hello!" ); </script> when call <script src="http://www.test/themes/default-bootstrap/js/modules/blocktopmenu/js/hoverIntent.js"></script> add to end body data-keepinline is how it's done. glad you got it sorted 1 Link to comment Share on other sites More sharing options...
Ron morales Posted August 6, 2014 Share Posted August 6, 2014 Yes sorry data-keepline ="SRC... I put but go to end Link to comment Share on other sites More sharing options...
El Patron Posted August 6, 2014 Share Posted August 6, 2014 Yes sorry data-keepline ="SRC... I put but go to end sorry you still have issue, my understanding with previous post that you got it to work, I can not really help you more and as suggested earlier you should post in the topic with this hack so it can be reviewed by that poster. Link to comment Share on other sites More sharing options...
Ron morales Posted August 6, 2014 Share Posted August 6, 2014 OK very thanks of spain Link to comment Share on other sites More sharing options...
El Patron Posted August 6, 2014 Share Posted August 6, 2014 OK very thanks of spain con mucho gusto Link to comment Share on other sites More sharing options...
Daniel - PrestaBR Posted August 25, 2014 Share Posted August 25, 2014 Hi there, El Patron Is it possible to keep a javascript file loading inside a div only in a CMS Page? I'd like to embed a tumblr page in cms.tpl: <div id="tumblr_page"> <script type="text/javascript" src="//prestashop.tumblr.com/js"></script> </div> If it moves to the end, the tumblr page renders after the footer... If I disable the function, it works, but it loads all other scripts inside header in all pages... Link to comment Share on other sites More sharing options...
El Patron Posted August 25, 2014 Share Posted August 25, 2014 Hi there, El Patron Is it possible to keep a javascript file loading inside a div only in a CMS Page? I'd like to embed a tumblr page in cms.tpl: <div id="tumblr_page"> <script type="text/javascript" src="//prestashop.tumblr.com/js"></script> </div> If it moves to the end, the tumblr page renders after the footer... If I disable the function, it works, but it loads all other scripts inside header in all pages... did you add to cms and it loaded bottom, i.e. you can add it to cms without issue? please follow this post, it shows how one can add javascript and be excluded from auto move bottom (keep at top). Please post there if you have any questions concerning that method. It does work as several have used this solution. http://www.prestashop.com/forums/topic/315798-no-html-allowed-in-blockcmsinfo/?p=1666595 1 Link to comment Share on other sites More sharing options...
Daniel - PrestaBR Posted August 25, 2014 Share Posted August 25, 2014 Thanks El Patron Unfortunately, That doesn't add anything new to this. What I wanted is to add a condition to keep JS files in place only for a determined page or file. The best option would be if the attribute "data-keepline" did that. But it doesn't. I guess that works only for inline JS. I could write an override for the class/controller that moves the JS to the end of the page. Do you know where is it? Thanks. Link to comment Share on other sites More sharing options...
El Patron Posted August 25, 2014 Share Posted August 25, 2014 Thanks El Patron Unfortunately, That doesn't add anything new to this. What I wanted is to add a condition to keep JS files in place only for a determined page or file. The best option would be if the attribute "data-keepline" did that. But it doesn't. I guess that works only for inline JS. I could write an override for the class/controller that moves the JS to the end of the page. Do you know where is it? Thanks. sorry, I thought in-line, so this is called within module yes? Link to comment Share on other sites More sharing options...
Daniel - PrestaBR Posted August 25, 2014 Share Posted August 25, 2014 (edited) No. I mean the code is loaded from an external file, not written directly in the .TPL (inline). What I did was to insert the file manually in cms.tpl, like this: {if $cms->id eq '10'} <div id="tumblr_test" class="col-sm-12 col-md-12 col-xs-12"> <script type="text/javascript" src="//prestashop.tumblr.com/js" data-keepinline="true"></script> <script type="text/javascript"> $('.tumblr_post').addClass('col-sm-3 col-md-3 col-xs-12'); </script> </div> {/if} That works like a charm without moving to the end of the page, 'cause it has to load inside the <div></div>. If override the controller/class that moves the JS to the end I can put a condition like: if ($page_name !== 'cms') { // Move to the end }else{ // Keep in header } I just need to know which class/controller does that... Thanks Edited August 25, 2014 by Daniel - PrestaBR addicional info (see edit history) 1 Link to comment Share on other sites More sharing options...
SupaMonkey Posted August 29, 2014 Share Posted August 29, 2014 Yeah, its awesome that PS now has the 'move JS to bottom' option, but really - as some of you have stated already, something just HAVE to run exactly where put. I've created a feature request for this. http://forge.prestashop.com/browse/PSCSX-3181 Please be sure to go check it out and give it some backup! Link to comment Share on other sites More sharing options...
ps3z Posted December 8, 2014 Share Posted December 8, 2014 hi i have problem with java move to end option. if i enable it from performance... my payment system is forwarding to previous page.and it doesnt work.if i disable java move to end. states are being invisible on address. Do you have any idea about it? Thanks in advance Link to comment Share on other sites More sharing options...
El Patron Posted December 8, 2014 Share Posted December 8, 2014 hi i have problem with java move to end option. if i enable it from performance... my payment system is forwarding to previous page.and it doesnt work.if i disable java move to end. states are being invisible on address. Do you have any idea about it? Thanks in advance Not all templates modules are 1.6 javascript bottom compliant. Prior to 1.6.0.7 all javascript was forced to bottom without option. This created a 'few' issues with theme/module developers work, so in 1.6.0.7 they added enable/disable move. There is not 'easy' solution for you to make your modules compliant with move all bottom, sorry. I wish you the best if you want to try. With my JavaPro, you can select which java moves bottom, while keeping up top those required. Link to comment Share on other sites More sharing options...
ps3z Posted December 9, 2014 Share Posted December 9, 2014 (edited) i checked..theme have some problem with java. default theme no have any problem like this. im gonna change my theme now as sleepy Edited December 9, 2014 by ps3z (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted December 9, 2014 Share Posted December 9, 2014 i checked..theme have some problem with java. default theme no have any problem like this. im gonna change my theme now as sleepy Please open new topic, this topic marked solved. Then please pm me the link to the new topic, thanks. Yes, I sleepy to, good night all. Link to comment Share on other sites More sharing options...
Recommended Posts