Quantcast
Channel: Webkul Blog
Viewing all articles
Browse latest Browse all 5489

Global action hook with add, update and delete function in Prestashop

$
0
0

If you want to perform any action Before Or After prestashop backend activities like add, update, and delete to different types of entities then you can use following hooks –

These hooks are defined in add, update and delete function of ObjectModel class of Prestashop.

1. For Add function – 

 

  • Action Before Activity –

Hook::exec('actionObject'.get_class($this).'AddBefore', array('object' => $this));

Here, get_class($this) defines your class name and array(‘object’ => $this) defines object with a particular ID of that class.

For example, if you want to perform any action of your module BEFORE add product in prestashop catalog then you can use this hook. For this, Hook name will be ‘actionObjectProductAddBefore‘.

All hooks will work similarly.

 

  • Action After Activity –

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

Ex. Hook name for product – ‘actionObjectProductAddAfter

2. For Update function –

 

  • Action Before Activity –

Hook::exec('actionObject'.get_class($this).'UpdateBefore', array('object' => $this));

Ex. Hook name for product – ‘actionObjectProductUpdateBefore

 

  • Action After Activity –

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

Ex. Hook name for product – ‘actionObjectProductUpdateAfter

3. For Delete function –

 

  • Action Before Activity –

Hook::exec('actionObject'.get_class($this).'DeleteBefore', array('object' => $this));

Ex. Hook name for product – ‘actionObjectProductDeleteBefore

 

  • Action After Activity –

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

Ex. Hook name for product – ‘actionObjectProductDeleteAfter


Viewing all articles
Browse latest Browse all 5489

Trending Articles