Page 1 of 1

extension development bug

Posted: Wed Jul 10, 2019 3:04 am
by prestin@surchx.com
I have developed an extension for opencart and I have added an event using 'addEvent' method. The event is triggering properly but the issue is that upon uninstalling the extension I am getting some fatal error . this is the error I am getting "Fatal error: Uncaught Error: Call to a member function deleteEventByCode() on null"

My uninstall function is
public function uninstall() {
$this->load->model('setting/event');
$this->model_settings_event->deleteEventByCode('EVENTCODE');
}
Any help will be much appreciated

Re: extension development bug

Posted: Wed Jul 10, 2019 4:27 am
by OSWorX
Well, no wonder.
It should be:

Code: Select all

$this->model_setting_event->deleteEventByCode('EVENTCODE');
(1 s too much)

Re: extension development bug

Posted: Wed Jul 10, 2019 5:27 am
by thekrotek
Error message usually tells you, what's wrong. In your case the model (class) wasn't properly called and initiated.

Re: extension development bug

Posted: Wed Jul 10, 2019 2:44 pm
by OSWorX
thekrotek wrote:
Wed Jul 10, 2019 5:27 am
Error message usually tells you, what's wrong. In your case the model (class) wasn't properly called and initiated.
No, not correct.
He called the model correct with:

Code: Select all

$this->load->model('setting/event');
but then he used:

Code: Select all

$this->model_settings_event->deleteEventByCode('EVENTCODE');
which is wrong (settings instead setting).