post.order.add event not triggred opencart

453 Views Asked by At

Hello I have created one event "post.order.add" but it is not triggered. in admin\controller\extension\module\my_api.php

public function install() {
      $this->model_extension_event->addEvent('myapi', 'post.order.add', 'extension/module/my_api/my_call_api');
    }

I have created function my_call_api in catalog\controller\extension\module\my_api.php and I am sending mail.

public function my_call_api($order_id)
    {
        $admin_mail = $this->config->get('config_email');

        mail($admin_mail, "Add Order post id - catlog", $order_id);
    }

but it will not triggered even and i am not getting any mail. I got order confirmation mail but not this event mail. anything wrong with my code.

1

There are 1 best solutions below

0
On

you need to load $this->load->model('extension/event'); inside the install method