我正在尝试在Opencart 3.0.3.2中触发新的扩展 通过安装程序加载时未添加事件,但是如果我在数据库中手动创建事件,则代码将触发。 如何获取安装事件以在上传时运行?或在“模块”中添加选项以使用户能够安装它?
这是我的扩展文件路径\admin\controller\extension\my_evts.php
class Controllerextensionmyevts extends Controller {
public function install(){
$this->load->model('setting/event');
$this->model_setting_event->addEvent('aaa_test_of_an_event', 'admin/model/catalog/product/editProduct/after', 'extension/my_evts/my_call_api');
}
public function my_call_api($data){
$admin_mail = $this->config->get('config_email');
mail($admin_mail, "Ext Evt Tests Order Id");
}
public function uninstall() {
$this->load->model('setting/event');
$this->model_setting_event->deleteEventByCode('aaa_test_of_an_event');
}
}