Search code examples
opencartopencart-3opencart-module

How to receive module ID on Opencart frontend


I'm trying to prepare a module. I need the module_id value. I will draw data with the module_id value. How do I get module_id in the controller on the front side.


Solution

  • Your suggestion may apply to single module.

    My module has sub-modules.

    But I found the solution.

    Design layout have solved the work with files.

    catalog / controller / common / common_left.php
    catalog / controller / common / common_right.php
    catalog / controller / common / head_top.php
    catalog / controller / common / head_bottom.php
    

    etc.

    I added a starred code.

        if (isset($part[1])) {
            $setting_info = $this->model_setting_module->getModule($part[1]);
    
            if ($setting_info && $setting_info['status']) {
            ***** $setting_info["module_id"] = $part[1]; *****
                $output = $this->load->controller('extension/module/' . $part[0], $setting_info);
    
                if ($output) {
                    $data['modules'][] = $output;
                }
            }
        }