AcidLava Posted March 11, 2023 Share Posted March 11, 2023 (edited) Hello, I'd like to hook ps_langageselector and ps_currencyselector on displayHeader. Unfortunately, it seems that all the hooks are available except this one. I'm looking for a way to add this hook but I can't find any clear tutorial about adding a native hook to a module on PS 1.7. Could you please help ? Thanks. Edited March 11, 2023 by AcidLava (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted March 11, 2023 Share Posted March 11, 2023 I think this .doc will help, Register a new hook: https://devdocs.prestashop-project.org/1.7/development/components/hook/register-new-hook/#prepare-database-update-for-auto-upgrades Link to comment Share on other sites More sharing options...
AcidLava Posted March 11, 2023 Author Share Posted March 11, 2023 (edited) Hello, thanks for your feedback. But this is about registering a new hook and I just need to add a native one to a module. Edited March 11, 2023 by AcidLava (see edit history) Link to comment Share on other sites More sharing options...
Mediacom87 Posted March 11, 2023 Share Posted March 11, 2023 Other page in doc https://devdocs.prestashop-project.org/8/modules/concepts/hooks/ Link to comment Share on other sites More sharing options...
Mediacom87 Posted March 11, 2023 Share Posted March 11, 2023 Sorry, the same for 1.7 https://devdocs.prestashop-project.org/1.7/modules/concepts/hooks/#using-hooks Link to comment Share on other sites More sharing options...
AcidLava Posted March 11, 2023 Author Share Posted March 11, 2023 (edited) Hello Mediacom87, thanks for your time. I've seen this one but it's not very clear to me. In my case and for example, I make a folder ps_languageselector in override/modules, then a file ps_languageselector.php. In the .php file I write : public function install() { $this->registerHook('displayHeader'); } public function hookDisplayHeader(array $params) { // Your code. } What I am supposed to add in "Your code" ? Thanks. Edited March 11, 2023 by AcidLava (see edit history) Link to comment Share on other sites More sharing options...
Mediacom87 Posted March 12, 2023 Share Posted March 12, 2023 You want to make an override on this module, but what do you want to do exactly ? Link to comment Share on other sites More sharing options...
AcidLava Posted March 12, 2023 Author Share Posted March 12, 2023 I want to hook the module on displayHeader. Link to comment Share on other sites More sharing options...
Mediacom87 Posted March 12, 2023 Share Posted March 12, 2023 Il y a 9 heures, AcidLava a dit : I want to hook the module on displayHeader. Okay, in Your code, you put in what you need to put in to make it do what you want it to do. Link to comment Share on other sites More sharing options...
AcidLava Posted March 12, 2023 Author Share Posted March 12, 2023 12 hours ago, Mediacom87 said: Okay, in Your code, you put in what you need to put in to make it do what you want it to do. 😐 Link to comment Share on other sites More sharing options...
Mediacom87 Posted March 13, 2023 Share Posted March 13, 2023 il y a une heure, AcidLava a dit : 😐 What do you want to do in displayHeader hook ? this hook is to put something before body tag, like for script or meta or css. But for script or css you need to use another solution. if you don’t clearly take time to explain clearly whet you want you can’t received a really interesting answer. 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