Jump to content

Hook ActionProductAdd is not executed


Hamendra Sunthwal

Recommended Posts

Hello 

 

public function install()
    {
        if (!parent::install()
           !$this->registerHook('actionObjectProductAddAfter')) {
            return false;
        }

        return true;
    }

public function hookActionObjectProductAddAfter($params){

}

 

This is not working even if try to create new product this hook calls, it calls on edit new product page.

Link to comment
Share on other sites

After create product:

hookActionObjectProductAddAfter

 

Before create product:

actionObjectProductAddBefore

 

https://devdocs.prestashop.com/1.7/modules/concepts/hooks/list-of-hooks/

 

actionObject<ObjectName>AddBefore

Located in: /classes/ObjectModel.php

actionObject<ObjectName>AddAfter

Located in: /classes/ObjectModel.php

actionObject<ObjectName>UpdateBefore

Located in: /classes/ObjectModel.php

actionObject<ObjectName>UpdateAfter

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

When you use before, you have no product information and you have to find the product id from the database (select max (id_product)) and add +1 to it, when you use after, you have all the product information.

Link to comment
Share on other sites

I do not understand your question.
I gave you a link to a list of hooks.
Just find the hook you need.
Use Ctrl + F = search.
Search for actionCart, actionOrder, displayOrder, actionCustomer, etc.

Edited by Guest (see edit history)
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...