Post by gandhi.pranav » Tue Nov 08, 2016 10:15 pm

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

Code: Select all

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.

Code: Select all

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.

Newbie

Posts

Joined
Tue Nov 08, 2016 10:04 pm

Post by opencartmart » Thu Dec 29, 2016 2:34 pm

There is a bug in your install method. You forgot to load event model. Code should be as follows:

Code: Select all

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

XForm - Opencart Form Builder
Xshippingpro - An advanced Shipping Module
Need Professional support? Skype: opencartmart


Active Member

Posts

Joined
Wed Oct 02, 2013 3:59 am
Who is online

Users browsing this forum: No registered users and 4 guests