Получение фатальной ошибки: вызов неопределенного метода Loader :: controller () в модуле оплаты Open Cart?

Я просто хотел клонировать платежный модуль moneybookers для расширения возможностей платежного модуля в Open Cart и предположить, что я застрял здесь с этой ошибкой:

Fatal error: Call to undefined method Loader::controller() in /home/hunter/public_html/opencart_new/admin/controller/payment/mpower.php on line 213

Вот полный /home/hunter/public_html/opencart_new/admin/controller/payment/mpower.php файл как:

<?php
class ControllerPaymentMPower extends Controller {
private $error = array();

public function index() {
$this->load->language('payment/mpower');

$this->document->setTitle($this->language->get('heading_title'));

$this->load->model('setting/setting');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('mpower', $this->request->post);

$this->session->data['success'] = $this->language->get('text_success');

$this->response->redirect($this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL'));
}

$data['heading_title'] = $this->language->get('heading_title');

$data['text_edit'] = $this->language->get('text_edit');
$data['text_enabled'] = $this->language->get('text_enabled');
$data['text_disabled'] = $this->language->get('text_disabled');
$data['text_all_zones'] = $this->language->get('text_all_zones');

$data['entry_MasterKey'] = $this->language->get('entry_MasterKey');
$data['entry_PublicKey'] = $this->language->get('entry_PublicKey');
$data['entry_PrivateKey'] = $this->language->get('entry_PrivateKey');
$data['entry_Mode'] = $this->language->get('entry_Mode');
$data['entry_Token'] = $this->language->get('entry_Token');
$data['entry_StoreName'] = $this->language->get('entry_StoreName');
$data['entry_StoreTagline'] = $this->language->get('entry_StoreTagline');
$data['entry_PhoneNumber'] = $this->language->get('entry_PhoneNumber');
$data['entry_PostalAddress'] = $this->language->get('entry_PostalAddress');
$data['entry_total'] = $this->language->get('entry_total');
$data['entry_order_status'] = $this->language->get('entry_order_status');
$data['entry_pending_status'] = $this->language->get('entry_pending_status');
$data['entry_canceled_status'] = $this->language->get('entry_canceled_status');
$data['entry_failed_status'] = $this->language->get('entry_failed_status');
$data['entry_chargeback_status'] = $this->language->get('entry_chargeback_status');
$data['entry_geo_zone'] = $this->language->get('entry_geo_zone');
$data['entry_status'] = $this->language->get('entry_status');
$data['entry_sort_order'] = $this->language->get('entry_sort_order');
$data['entry_custnote'] = $this->language->get('entry_custnote');

$data['help_total'] = $this->language->get('help_total');

$data['button_save'] = $this->language->get('button_save');
$data['button_cancel'] = $this->language->get('button_cancel');

if (isset($this->error['warning'])) {
$data['error_warning'] = $this->error['warning'];
} else {
$data['error_warning'] = '';
}

if (isset($this->error['email'])) {
$data['error_email'] = $this->error['email'];
} else {
$data['error_email'] = '';
}

$data['breadcrumbs'] = array();

$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
);

$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_payment'),
'href' => $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL')
);

$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('payment/mpower', 'token=' . $this->session->data['token'], 'SSL')
);

$data['action'] = $this->url->link('payment/mpower', 'token=' . $this->session->data['token'], 'SSL');

$data['cancel'] = $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL');

if (isset($this->request->post['mpower_MasterKey'])) {
$data['mpower_MasterKey'] = $this->request->post['mpower_MasterKey'];
} else {
$data['mpower_MasterKey'] = $this->config->get('mpower_MasterKey');
}

if (isset($this->request->post['mpower_PublicKey'])) {
$data['mpower_PublicKey'] = $this->request->post['mpower_PublicKey'];
} else {
$data['mpower_PublicKey'] = $this->config->get('mpower_PublicKey');
}

if (isset($this->request->post['mpower_PrivateKey'])) {
$data['mpower_PrivateKey'] = $this->request->post['mpower_PrivateKey'];
} else {
$data['mpower_PrivateKey'] = $this->config->get('mpower_PrivateKey');
}

if (isset($this->request->post['mpower_Token'])) {
$data['mpower_Token'] = $this->request->post['mpower_Token'];
} else {
$data['mpower_Token'] = $this->config->get('mpower_Token');
}

if (isset($this->request->post['mpower_mode'])) {
$data['mpower_mode'] = $this->request->post['mpower_mode'];
} else {
$data['mpower_mode'] = $this->config->get('mpower_mode');
}

if (isset($this->request->post['mpower_StoreName'])) {
$data['mpower_StoreName'] = $this->request->post['mpower_StoreName'];
} else {
$data['mpower_StoreName'] = $this->config->get('mpower_StoreName');
}

if (isset($this->request->post['mpower_StoreTagline'])) {
$data['mpower_StoreTagline'] = $this->request->post['mpower_StoreTagline'];
} else {
$data['mpower_StoreTagline'] = $this->config->get('mpower_StoreTagline');
}

if (isset($this->request->post['mpower_PhoneNumber'])) {
$data['mpower_PhoneNumber'] = $this->request->post['mpower_PhoneNumber'];
} else {
$data['mpower_PhoneNumber'] = $this->config->get('mpower_PhoneNumber');
}

if (isset($this->request->post['mpower_PostalAddress'])) {
$data['mpower_PostalAddress'] = $this->request->post['mpower_PostalAddress'];
} else {
$data['mpower_PostalAddress'] = $this->config->get('mpower_PostalAddress');
}

if (isset($this->request->post['mpower_total'])) {
$data['mpower_total'] = $this->request->post['mpower_total'];
} else {
$data['mpower_total'] = $this->config->get('mpower_total');
}

if (isset($this->request->post['mpower_order_status_id'])) {
$data['mpower_order_status_id'] = $this->request->post['mpower_order_status_id'];
} else {
$data['mpower_order_status_id'] = $this->config->get('mpower_order_status_id');
}

if (isset($this->request->post['mpower_pending_status_id'])) {
$data['mpower_pending_status_id'] = $this->request->post['mpower_pending_status_id'];
} else {
$data['mpower_pending_status_id'] = $this->config->get('mpower_pending_status_id');
}

if (isset($this->request->post['mpower_canceled_status_id'])) {
$data['mpower_canceled_status_id'] = $this->request->post['mpower_canceled_status_id'];
} else {
$data['mpower_canceled_status_id'] = $this->config->get('mpower_canceled_status_id');
}

if (isset($this->request->post['mpower_failed_status_id'])) {
$data['mpower_failed_status_id'] = $this->request->post['mpower_failed_status_id'];
} else {
$data['mpower_failed_status_id'] = $this->config->get('mpower_failed_status_id');
}

if (isset($this->request->post['mpower_chargeback_status_id'])) {
$data['mpower_chargeback_status_id'] = $this->request->post['mpower_chargeback_status_id'];
} else {
$data['mpower_chargeback_status_id'] = $this->config->get('mpower_chargeback_status_id');
}

$this->load->model('localisation/order_status');

$data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();

if (isset($this->request->post['mpower_geo_zone_id'])) {
$data['mpower_geo_zone_id'] = $this->request->post['mpower_geo_zone_id'];
} else {
$data['mpower_geo_zone_id'] = $this->config->get('mpower_geo_zone_id');
}

$this->load->model('localisation/geo_zone');

$data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();

if (isset($this->request->post['mpower_status'])) {
$data['mpower_status'] = $this->request->post['mpower_status'];
} else {
$data['mpower_status'] = $this->config->get('mpower_status');
}

if (isset($this->request->post['mpower_sort_order'])) {
$data['mpower_sort_order'] = $this->request->post['mpower_sort_order'];
} else {
$data['mpower_sort_order'] = $this->config->get('mpower_sort_order');
}

if (isset($this->request->post['mpower_rid'])) {
$data['mpower_rid'] = $this->request->post['mpower_rid'];
} else {
$data['mpower_rid'] = $this->config->get('mpower_rid');
}

if (isset($this->request->post['mpower_custnote'])) {
$data['mpower_custnote'] = $this->request->post['mpower_custnote'];
} else {
$data['mpower_custnote'] = $this->config->get('mpower_custnote');
}

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');

$this->response->setOutput($this->load->view('payment/mpower.tpl', $data));
}

protected function validate() {
if (!$this->user->hasPermission('modify', 'payment/mpower')) {
$this->error['warning'] = $this->language->get('error_permission');
}

if (!$this->request->post['mpower_MasterKey']) {
$this->error['MasterKey'] = $this->language->get('error_MasterKey');
}

if (!$this->request->post['mpower_PublicKey']) {
$this->error['PublicKey'] = $this->language->get('error_PublicKey');
}

if (!$this->request->post['mpower_PrivateKey']) {
$this->error['PrivateKey'] = $this->language->get('error_PrivateKey');
}

if (!$this->request->post['mpower_Token']) {
$this->error['Token'] = $this->language->get('error_Token');
}

return !$this->error;
}
}

Строка № 213 это:

$data['header'] = $this->load->controller('common/header');

Я не закончил полностью разработку модуля, но почти закончил работу со стороной администратора платежного модуля, но он выдает ошибку, поэтому, если кто-то может, пожалуйста, взгляните и дайте мне знать, что я делаю неправильно, пожалуйста?

2

Решение

Вот ваш код после строки № 213:

Заменить этот код:

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');

$this->response->setOutput($this->load->view('payment/mpower.tpl', $data));

С

$this->template = 'payment/mpower.tpl';
$this->children = array(
'common/header',
'common/column_left',
'common/footer'
);

$this->response->setOutput($this->render());

Нет необходимости вызывать контроллер для заголовка, нижнего колонтитула и т. Д.

А также не нужно проходить $data в setOutput, он автоматически передаст ваш файл представления, когда вы загрузите ссылку на платежный шлюз в браузере, потому что он по умолчанию вызовет ваш индексный метод.

1

Другие решения

Я столкнулся с той же проблемой и обнаружил, что я использую 2.0.X.X модуль в версии opencart 1.5.X.X, Возможно, вы просто используете не ту версию модуля.

1

По вопросам рекламы [email protected]