khalilgrom Posted July 8, 2020 Share Posted July 8, 2020 (edited) I want to exchange Mega Menu modulewith search module I searched in apparance / positions but each of them belongs to a different hook how to achieve this thank you Edited July 9, 2020 by khalilgrom (see edit history) Link to comment Share on other sites More sharing options...
Minsky_ae Posted July 8, 2020 Share Posted July 8, 2020 Hi @khalilgrom, If I understand well, you just need to unhook megamenu and re-hook it to the hook where Search module is. Then do the same for Search module. When you're in Apparence > Positions, for each module you have a Modify button and an arrow, click on that one to access the unhook (not sure of the English name) function. Then on same screen, top right, you shoud have two buttons "Hook" and "Help" (again not sure about the name), use the Hook button to select your module and the hook you want for it to be displayed. Hope it helps! Link to comment Share on other sites More sharing options...
khalilgrom Posted July 8, 2020 Author Share Posted July 8, 2020 thansk for your reply, yes that is what I want, but when I enter modify page I don't find the others hook to choose I just find displaymegamenu hook and header hook Link to comment Share on other sites More sharing options...
Minsky_ae Posted July 8, 2020 Share Posted July 8, 2020 (edited) I reckon you'll need to override this module to register the hook you want. But I'm not entirely sure as I'm a beginner in PrestaShop! And maybe the module is not ready to be hooked somewhere else. First method is to find the module folder under modules in your project. Under the function install() you should see the hook registration. It should look something like this: public function install() { return parent::install() && $this->registerHook('header') && $this->registerHook('displayBanner'); } You can try to add the hook you want. You might need to uninstall and reinstall the module to see the change. Be aware that this solution will be lost if you update the module. Other way to try to do this and still be able to update the module is to override it. You can try to add a new PHP file under override > modules > name_of_your_module > name_of_your_module.php In the file you created, you start with: <?php if (!defined('_PS_VERSION_')) exit; class Ps_NameOfModuleOverride extends Ps_NameOfModule { } Then you override here the install function. Again I'm a beginner so I'm not sure if it this will work. Edited July 8, 2020 by Minsky_ae (see edit history) 1 Link to comment Share on other sites More sharing options...
khalilgrom Posted July 9, 2020 Author Share Posted July 9, 2020 thanks bro, without reinstall module, I have added this function (and copy paste content from hookDisplayMegamenu function) in 'posmegamenu.php' file and the hook function appear in position page of module and I choose it public function hookDisplaySearchTop() Link to comment Share on other sites More sharing options...
Minsky_ae Posted July 9, 2020 Share Posted July 9, 2020 @khalilgrom Glad I could help! Maybe you can edit your first message to add [SOLVED] at the beginning of your title, I saw some people doing this and it's quite useful to see that your problem was resolved if others got the same one ;) 1 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