Jump to content

PrestaShop 1.6: module not displaying javascript


shopapps

Recommended Posts

Hi,

 

I have an odd behaviour going on and was wondering if anyone had experienced anything similar and hence how to resolve it.

 

i have a module, that is hooked to the footer.  It worked perfectly in 1.5  but doesn't display any script content in 1.6????

 

I have eliminated all the code and broken the footer.tpl file down to only contain:

{debug}
// before
<p>hello world</p>
<script type="text/javascript">
  var x = 1;
</script>
// after

when I do  view-source in only see:

// before
<p>hello world</p>

// after

I see no errors in my syslog,php log or webserver error logs. 

 

the calling function:  hookDisplayFooter($params)  contains some code the key bit of which is:

$data 		= $this->_getFrontData();
$page_data 	= $this->_GetPageData($params);
		
$this->smarty->assign(array(
	 'data'		=> $data
	,'img_path' 	=> $this->_path . 'images/'
	,'l' 		=> $this->context->language->id
	,'module_name'	=> $this->name
	,'params' 	=> $params	
	,'page_data'	=> $page_data
));
return $this->display ( __FILE__, 'footer.tpl');

Any help would be much appreciated.

 

thanks.

 

 

Link to comment
Share on other sites

Further to this, I have now discovered that actually, PrestaShop 1.6 is stripping all JavaScript code out and moving it to a separate location under a single:

$(document).ready( function() { 

});

I can understand why this can be handy from a timing perspective for some external script loading.  However where not required, does anyone know how to disable this default behaviour?

Link to comment
Share on other sites

Hi,

 

There's a little bit more to it than that I'm afraid.  Its actually a new policy that PS1.6 have globally introduced with no current method to stop it happening.  However as per this post:

 

http://www.prestashop.com/forums/topic/315798-no-html-allowed-in-blockcmsinfo/?p=1699727

 

They have recognised the need to not do this, so have introduced a workaround for one of the later releases....   very disappointing it was introduced in the first place, but there you go! 

 

I'll go ahead and mark it as solved, although it's more like resolved. ;)

Edited by shopapps (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...