dongyue4964 2015-02-10 13:58
浏览 75
已采纳

OpenCart 2.0我无法添加模块(ControllerModuleMinicart :: redirect()错误)

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..)

  • 写回答

1条回答 默认 最新

  • douheng8629 2015-02-11 07:54
    关注

    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'));

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥15 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题