我不入坑"ActionProductCreate"
I don't enter in the hook "ActionProductCreate"
我正在 prestashop 1.7 上做一个模块,我想做的更简单:在创建产品时在 SQL table 中添加一行。所以我使用以下钩子:
public function hookActionProductCreate($params) {}
我将此代码放在钩子中,但在我的 table 一侧没有任何反应,没有添加行:
public function hookActionProductCreate($params) {
//Full name of my table : ps_mtp_product_dpt
Db::getInstance()->insert('mtp_product_dpt', array(
'id_product' => 5,
'id_departement' => 25,
));
}
谢谢你的帮助
我找到了解决方案,你只需要使用这个钩子:
hookActionObjectProductAddAfter
再见
我正在 prestashop 1.7 上做一个模块,我想做的更简单:在创建产品时在 SQL table 中添加一行。所以我使用以下钩子:
public function hookActionProductCreate($params) {}
我将此代码放在钩子中,但在我的 table 一侧没有任何反应,没有添加行:
public function hookActionProductCreate($params) {
//Full name of my table : ps_mtp_product_dpt
Db::getInstance()->insert('mtp_product_dpt', array(
'id_product' => 5,
'id_departement' => 25,
));
}
谢谢你的帮助
我找到了解决方案,你只需要使用这个钩子:
hookActionObjectProductAddAfter
再见