Andrei Silveanu
Andrei Silveanu

Reputation: 3

How to create a prestashop module that triggers codeon add/edit/delete products/categories

I am currently new to prestashop.

I managed to build a simple module (in prestashop 1.7), but I also want my module to trigger some code when a product or category is changed/added/deleted.

How can I do that?

Upvotes: 0

Views: 337

Answers (1)

sadlyblue
sadlyblue

Reputation: 2987

ObjectModel calls this after every add:

Hook::exec('actionObject'.$this->getFullyQualifiedName().'AddAfter', array('object' => $this));

and every update:

Hook::exec('actionObject'.$this->getFullyQualifiedName().'UpdateAfter', array('object' => $this));

and every deletion:

Hook::exec('actionObject'.$this->getFullyQualifiedName().'DeleteAfter', array('object' => $this));

So hook to actionObjectProductAddAfter, actionObjectProductUpdateAfter and actionObjectProductDeleteAfter for products, and the same for categories.

Upvotes: 1

Related Questions