Opencart2 : Create custom module in admin

Here is the way add custom helloworld module in admin.

  1. create admin/controller/custom/helloworld.php
    <?php
    class ControllerCustomHelloworld extends Controller {
    
     public function index() {
    
     $this->load->language('custom/helloworld');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->load->model('custom/helloworld');        
    
     $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('custom/helloworld.tpl', $data));
    
     }
    }
    ?>
  2. Create admin/model/custom/helloworld.php

    <?php
    class ModelCustomHelloworld extends Model {
    
    public function helloworldmodel(){
    
     }
    }
    ?>
  3. create admin/language/english/custom/helloworld.php

    <?php
    // Heading
    $_['heading_title']          = 'Hello world Admin module';
    
    ?>
  4. Create admin/view/template/custom/helloworld.tpl

    <?php echo $header; ?><?php echo $column_left; ?>
    <h1><?php echo "This is helloworld admin module in opencart 2.x.x.x "; ?></h1>         
    <?php echo $footer; ?>
  5. Go to system -> users -> user groups -> edit Administrator group. Select all to access permission and modify permission and save.custom-module