Jump to content

Why is the hook not showing?


sfhbsf

Recommended Posts

Hello

 

I have this code and none of these hooks is showing. I have all caches deactivated and cleared cache.

 

 

public function install()
    {
    
      return parent::install() && $this->registerHook('orderDetail') && $this->registerHook('header') && $this->registerHook('shoppingCart');
    }

    public function hookDisplayShoppingCart($params)
    {
        echo "asdf";
        exit();
    }
    public function hookDisplayOrderDetail($params)
    {
        echo "asdf";
        exit();
    }
    public function hookDisplayHeader()
{
  $this->context->controller->addCSS($this->_path.'css/mymodule.css', 'all');

Edited by sfhbsf (see edit history)
Link to comment
Share on other sites

Your code looks correct. The hookDisplayShoppingCart fires when the buyer lands on steps 1 and 5 of the checkout process.

 

Are you sure that the module is installed and initialized correctly?

 

Try adding:

 

if (!parent::install() || 
            !$this->registerHook('header') || 
            !$this->registerHook('payment') || 
            !$this->registerHook('paymentReturn') || 
            !$this->registerHook('displayShoppingCart'))
        {
            return false;
        }
 
To the install method - if all of the hooks are not installed correctly the module itself will not be installed so you will know there is a problem. If it does install then you should be able to use your hooks.
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...