If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

OpenCart 2.x. How to deal with “Fatal error: Call to a member function getModule()” error after activating “Maintenance Mode”

This tutorial will show you how to deal with ‘Fatal error: Call to a member function getModule()’ error after activating ‘Maintenance Mode’ in OpenCart.

OpenCart 2.x. How to deal with “Fatal error: Call to a member function getModule()” error after activating “Maintenance Mode”

The error usually looks like this:

OpenCart_2_How_to_deal_with_Fatal_error_Call_to_a_member_function_getModule_error_after_activating_Maintenance_Mode_1

Let’s see how to fix it:

  1. Open the file catalog/controller/common/header_center.php.

  2. Locate the line:

    $this->load->model('design/layout');
  3. Add the following code right after that line:

    $data['maintenance'] = $this->config->get('config_maintenance');
  4. Locate the following lines:

    if (isset($part[1])) {
    			$setting_info = $this->model_extension_module->getModule($part[1]);
    			
    			if ($setting_info && $setting_info['status']) {
    			$data['modules'][] = $this->load->controller('module/' . $part[0], $setting_info);
    			}
    			}
    		
  5. Replace them with:

    			if ($data['maintenance'] == 0){
    			if (isset($part[1])) {
    			$setting_info = $this->model_extension_module->getModule($part[1]);
    			
    			if ($setting_info && $setting_info['status']) {
    			$data['modules'][] = $this->load->controller('module/' . $part[0], $setting_info);
    			}
    			}
    			}
    		
  6. Save the changes. Log out from your Opencart dashboard, clear browser cache to see the changes:

    OpenCart_2_How_to_deal_with_Fatal_error_Call_to_a_member_function_getModule_error_after_activating_Maintenance_Mode_2

Feel free to check the detailed video tutorial below:

OpenCart 2.x. How to deal with “Fatal error: Call to a member function getModule()” error after activating “Maintenance Mode”