Jump to content

Override javascript file


Recommended Posts

Hi guys :) First of all, sorry for my English.


I have unsuccessfully been looking for a solution to my problem.


I'm developing a module which overrides an admin controller class. The base controller loads a javascript file, let's say /js/foo.js, through $this->addJS(_PS_JS_DIR_.'foo.js') which is ok. But the point is I also need to override that javascript file. Placing a newly created js file in /override/js/foo.js takes no effect.


Is it possible to override a JavaScript file?


I'm opened to other solutions, i.e. directly adding a custom js file, but the only way I can figure out is by hardcoding the URL (which of course is not ok). How can a module js file be loaded by a overridden controller without hardcoding its path?


Thanks a lot.

Link to comment
Share on other sites

  • 3 months later...

Hi gnoma,


are you developing a module or an override?

As far as I know, if it's a module you have to put all the js files required under %root%/modules/my_module/js/ or %root%/themes/(default or)my_theme/modules/my_module/js/ in case you are overriding an existing module :)

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...