当我点击模块中的保存按钮时,无法找到重定向页面

时间:2016-10-13 06:24:53

标签: php opencart opencart2.x opencart-module

无法找到页面重定向!什么时候,我点击管理员OpenCart 2.1.0.1中模块的保存按钮。

我认为,模块保存按钮代码是正确的。但是,在这里,我无法理解。我的自定义模块中有什么问题。我有仔细检查。

请参阅以下屏幕截图。什么时候,我点击管理员模块中的保存按钮。所以,它确实重定向“你找不到的页面!”前面。但是,页面网址仍然是管理员。

enter image description here

我的管理模块控制器文件代码

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

    public function index() {   

      $language = $this->load->language('module/mytheme');
        $data = array_merge($language);


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

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

        $this->load->model('tool/image'); 

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

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

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


            $data['text_image_manager'] = 'Image manager';
            $data['token'] = $this->session->data['token'];       

        $text_strings = array(
                'heading_title',
                'text_enabled',
                'text_disabled',
                'text_content_top',
                'text_content_bottom',
                'text_column_left',
                'text_column_right',
                'entry_status',
                'entry_sort_order',
                'button_save',
                'button_cancel',

        );

        foreach ($text_strings as $text) {
            $data[$text] = $this->language->get($text);
        }


        // store config data

        $config_data = array(

        //Status
      'mytheme_status',
      'mytheme_skin',

      //Body Background
        'mytheme_background_color',
        'mytheme_button_color',
        'mytheme_button_hover_color',
        'mytheme_button_text_color',
        );

        foreach ($config_data as $conf) {
            if (isset($this->request->post[$conf])) {
                $data[$conf] = $this->request->post[$conf];
            } else {
                $data[$conf] = $this->config->get($conf);
            }
        }

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

        $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_module'),
            'href'      => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL')
        );

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

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

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


        if (isset($this->request->post['mytheme_module'])) {
            $modules = explode(',', $this->request->post['mytheme_module']);
        } elseif ($this->config->get('mytheme_module') != '') {
            $modules = explode(',', $this->config->get('mytheme_module'));
        } else {
            $modules = array();
        }           


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

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

      $data['languages'] = $this->model_localisation_language->getLanguages();


        $data['modules'] = $modules;

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

      }

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

      $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('module/mytheme.tpl', $data));

    }


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

      return !$this->error;
   }
}

可能是什么原因? 任何线索?

1 个答案:

答案 0 :(得分:0)

URL编码中的&通常存在问题,但是从您的屏幕截图看来,已经可以了。

所以一切看起来都不错,但是您可能已经更改了管理员URL的名称,因此它在“ / admin”中显示“ NOT FOUND”页面。