简体   繁体   中英

OpenCart 2.0 I can't add modules (ControllerModuleMinicart::redirect() error)

I'm trying to add modules to the latest OpenCart version and so far no one worked. First I'm trying to add side cart, I found couple modules, but all of them are for earler versions and doesn't work with 2.0, also I tried to add facebook like box extension and there are the same errors.

So after module download I change couple things like in this thread Thread

1. I changed all $this->data to $data .
2. $this->response->setOutput($this->render());
I changed to $this->response->setOutput($this->load->view('module/minicart.tpl', $data)); 3 I changed $this->children to

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

So no errors when I'm trying to manage this module, but error when i'm trying to save it
Fatal error: Call to undefined method ControllerModuleMinicart::redirect() in C:\\wamp\\www\\opencart\\admin\\controller\\module\\minicart.php on line 23

And the 23 line looks like:

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

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

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

What I need to change? How I can finally start using modules ( it seems all modules are still for early versions and we have to remake them all..)

Change

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

to

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM