I want execute some code when admin carrier add after, how to call the hook name?
I found the hookActionObjectCarrierAddAfter
but I can not get the params or carrier last insert.
I want execute some code when admin carrier add after, how to call the hook name?
I found the hookActionObjectCarrierAddAfter
but I can not get the params or carrier last insert.
Inside your module you should use:
class MyModule extends Module
{
public function install()
{
if (! parent::install() || ! $this->registerHook('actionObjectCarrierAddAfter'))
{
return false;
}
}
public function hookActionObjectCarrierAddAfter($params)
{
$carrier = $params['object'];
[...]
}
}
This hook is called from the method add
of class ObjectModel
:
public function add($auto_date = true, $null_values = false)
{
if (isset($this->id) && !$this->force_id) {
unset($this->id);
}
// @hook actionObject*AddBefore
Hook::exec('actionObjectAddBefore', array('object' => $this));
Hook::exec('actionObject'.get_class($this).'AddBefore', array('object' => $this));
// [...]
// [...]
// [...]
// @hook actionObject*AddAfter
Hook::exec('actionObjectAddAfter', array('object' => $this));
Hook::exec('actionObject'.get_class($this).'AddAfter', array('object' => $this));
return $result;
}