julien59 Posted August 2, 2016 Share Posted August 2, 2016 Hi all, On my site, I added a notion of delivery date. In a FrontController override in my module, in init(), I make a check to see if the delivery is still possible on the same day or, if it is too late, I postpone the delivery to the next day. I would like to display an alert (or fancybox or lightbox or ...) on pageload, one time only, to warn customer that his delivery date has been changed I cannot really see how to add javascript from FrontController / init() function. I come from the .net world and would add RegisterStartupScript() in that case, but in php ... I am not that confortable ;-) Any clue ? Thanks Julien Link to comment Share on other sites More sharing options...
rocky Posted August 2, 2016 Share Posted August 2, 2016 You can override the setMedia() function and add your JavaScript file there like this: public function setMedia() { parent::setMedia(); $this->addJS(_PS_MODULE_DIR_.'module_name/js/js_file.js'); } Link to comment Share on other sites More sharing options...
julien59 Posted August 3, 2016 Author Share Posted August 3, 2016 Thanks a lot ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now