S
S
Sergey Nizhny Novgorod2019-01-12 14:29:11
opencart
Sergey Nizhny Novgorod, 2019-01-12 14:29:11

How to transfer the event system from OpenCart 3.0 to 2.3.0.2?

Hello everyone
In the extension ported from opencart 3.0 to 2.3, this piece of code does not work:

public function install()
    {
        if (!$this->model_setting_event->getEventByCode('travesty_admin_column_left')) {
            $code = "travesty_admin_column_left";
            $trigger = "admin/view/common/column_left/before";
            $action = "extension/module/travesty/menu";
            $this->model_setting_event->addEvent($code, $trigger, $action);

            $code = "travesty_footer";
            $trigger = "catalog/view/common/footer/before";
            $action = "extension/module/travesty/footer";
            $this->model_setting_event->addEvent($code, $trigger, $action);

            $code = "travesty_header";
            $trigger = "catalog/view/common/header/before";
            $action = "extension/module/travesty/header";
            $this->model_setting_event->addEvent($code, $trigger, $action);
        }

    }

    public function uninstall()
    {
        $this->model_setting_event->deleteEventByCode('travesty_admin_column_left');
        $this->model_setting_event->deleteEventByCode('travesty_footer');
        $this->model_setting_event->deleteEventByCode('travesty_header');
    }

According to the documentation: https://github.com/opencart/opencart/wiki/Events-System
I actually have to add event loading, and change the event removal method. Everything else should work exactly the same, but the internal error fires. And I don't understand why. Error_log shows nothing on this account.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
web-mechanic, 2019-01-26
@amfetamine

it's smarter to upgrade 2.3 to 3, less problems, more value for the future

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question