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

图片转代码服务由CSDN问答提供 功能建议

我正在尝试将模块添加到最新的OpenCart版本中,到目前为止还没有人工作。 第一我是 试图添加侧面推车,我找到了几个模块,但所有这些都是针对earler版本而且不适用于2.0,我也尝试添加类似于盒子扩展的facebook,并且存在相同的错误。 \ n

因此,在模块下载后,我改变了这个线程中的一些事情,如 线程

1。我将所有 $ this-> data 更改为 $ data
2。 $ this-> response-> setOutput($ this-> render());
我改为 $ this-> response-> setOutput($ this-> load-> view('module / minicart.tpl',$ data)); 3 我将 $ this-> children 更改为

  $ data ['header'] = $ this-> load-> controller  ( '共同/报头'); 
 $的数据['colu  mn_left'] = $ this-> load-> controller('common / column_left'); 
 $ data ['footer'] = $ this-> load-> controller('common / footer');  
   
 
 

因此,当我尝试管理此模块时没有错误,但是当我尝试保存它时出错

致命错误 :在第23行的C:\ wamp \ www \ opencart \ admin \ controller \ module \ minicart.php中调用未定义的方法ControllerModuleMinicart :: redirect()

23行看起来像:

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

我需要改变什么? 我怎么能最终开始使用模块(似乎所有模块仍然适用于早期版本,我们必须重新制作所有模块..)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

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

    点赞 打赏 评论

相关推荐 更多相似问题