Iam creating a module for my site,Here i have used hookActionProductUpdate hook to insert some values in ps_game_key table .When product is updated insert query is executed two times.SO 2 records are inserted instead of inserting 1 record.This seems to hookActionProductUpdate is called two times.Please Help
class customsupplier
{
public function __construct()
{
$this->name = 'customsupplier';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'Rex';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('Custom Supplier');
$this->description = $this->l('Custom Supplier Module');
}
public function install()
{
if (!parent::install() OR
!$this->alterTable('add') OR
!$this->registerHook('actionAdminControllerSetMedia') OR
!$this->registerHook('actionProductUpdate') OR
!$this->registerHook('displayAdminProductsExtra'))
return false;
return true;
}
public function hookActionProductUpdate($params)
{
Db::getInstance()->insert('game_key', array(
'id_product' => 89,
'key_type' =>'test',
'game_key' => 'reee',
'added_date_time'=> 'ssd'
),true);
}
}