Search code examples
opencartopencart-3opencart-module

Add a new view in Openart(4) module


In Opencart(4) I am developing a new extension called "testimonials". Created the testimonials and working fine. Now I need to add a new page in the module. So I created a folder named "pages" inside the module's admin template and created a new template file inside it.Also added a function called "showTestPage()" to show the newly created page.

My controller file looks like

...
public function showTestPage(){
        $this->load->language('extension/testimonials/module/testimonials');
        $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('extension/testimonials/module/testimonials/pages/test', $data));
    }

When I tried to access the new page using the following url, its showing a permission denied error. Already checked all permissions in "User Group".

http://localhost/op4/admin/index.php?route=extension/testimonials/module/testimonials/showTestPage&user_tok...

Did I missed any steps ? Any idea ?


Solution

  • for the function path in controller do not use slash /

    http://localhost/op4/admin/index.php?route=extension/testimonials/module/testimonials/showTestPage&user_tok...
    

    use vertical bar | because framework in OC 4.0.x.x is changed...

    http://localhost/op4/admin/index.php?route=extension/testimonials/module/testimonials|showTestPage&user_tok...