Search code examples
opencartopencart-moduleopencart-3

Developing custom module in opencart 3


I am trying to develop a module in opencart 3.0.2.0. I have created a new basic file in controller\extension\module\sellerlist.php.

    class ControllerExtensionModuleSellerlist extends Controller {
    public function index() {
return $this->load->view('extension/module/sellerlist');
    }
}

Then I created a view file in catalog\view\theme\default\template\extension\module\sellerlist.twig

I have created admin file with class ControllerExtensionModuleSellerlist in admin\controller\extension\module\sellerlist.php And created a view file in admin\view\template\extension\module\sellerlist.twig

When I checked in admin panel --> extension --> module, I couldn't find my new module in that list.

What could be the reason for that? Thanks for any help.


Solution

  • Did you forget to create the admin language file for it?

    There is material on the web to show you all the files needed for it. This blog is a popular one: https://webkul.com/blog/create-first-basic-module-opencart/

    You need all three of these files: language, controller and view files in the admin side .

    If you don't have the language file, then there is no way you will even see the module listed to select it.

    admin/language/extension/module/sellerlist.php

    <?php
    
    // Heading
    $_['heading_title']    = 'Seller List';
    
    $_['text_module']      = 'Modules';
    $_['text_success']     = 'Success: You have modified "Seller List" module!';
    $_['text_edit']        = 'Edit "Seller List" Module';
    
    // Entry
    $_['entry_status']     = 'Status';
    
    // Error
    $_['error_permission'] = 'Warning: You do not have permission to modify "Seller List" module!';