PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, October 27, 2022

[FIXED] how to register and install hook in prestashop 1.7?

 October 27, 2022     hook, module, prestashop, prestashop-1.7     No comments   

Issue

I have added one module hook manage box in PrestaShop 1.7 . Module is installed and i have created one hook called dispalybeforehome but it is not showing me in my module. how to register it ?


Solution

In your module during the installation, with the install method you should add this snippet:

$this->registerHook('displayBeforeHome');

For example:

public function install()
{
    return parent::install() and $this->registerHook('displayBeforeHome');
}

Then you have to create the hookDisplayBeforeHome method in your module:

public function hookDisplayBeforeHome($params)
{
    // do your stuff
    return 'IT WORKS!';
}

Then in the template add the smarty snippet to call the hook:

{hook h='displayBeforeHome'}

That's all ;)



Answered By - marsaldev
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing