Jump to content

Add JS Script


Recommended Posts

Hi all, how do you add your won javascript file in a prestashop module, in 1.5? I tried all methods i could find on google but it's just not working. if i use addJS it says is deprecated and more than that it just doesn't work. Please Help!

Link to comment
Share on other sites

Hi, now uses : $this->context->controller->addCSS(); $this->context->controller->addJS(); ;)

 

Ok, but i can't make it work. I have my js in the same page with my tpl file i want the js to append. I tried :

$this->context->controller->addJS('jsName.js'); (not working)

I think i am doing it wrong, can you give me an example with directory paths and such? I would appreciate it greatly. Thanks.

Link to comment
Share on other sites

Ha ok! So, if your JS is in your theme directory, try:

 

$this->context->controller->addJS(_THEME_JS_DIR_.'[color=#343943][font=Arial,Helvetica,sans-serif][size=3]jsName.js[/size][/font][/color]');

 

Uses the PS defines vars :)

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...