Why is OpenCart maintenance mode turning on automatically?

Have you ever faced a situation that OpenCart automatically turned on Maintenance mode, leaving your site closed for visitors and search bots?

What is maintenance mode?

OpenCart has a feature called "Maintenance Mode". You can turn it on from your admin panel in system/settings. You may use this feature when you are doing an upgrade or simply want to shut the store done for a period of time.

While you are logged in, you will continue to see the storefront, but for everybody else, it will be closed.

Screen Shot 2019-03-01 at 9.08.32 PM

Frankly, this is not a good feature to use on your OpenCart store. Sure, if you are just launching your store and Google has not yet visited your site. No harm in that.

But if your site is indexed, you should never use Maintenance Mode. This mode will block search bots from indexing your site. This will result in your site being dropped from search results and lost traffic. The recovery may take from several days to several months and definitely lost sales.

Why is OpenCart Maintenance Mode turning on automatically

Now that you know what it is, you should also know that it may turn on automatically. In OpenCart starting from version 2.0, we have OCmod (OpenCart Modifications). This feature allows us to add extra functionality to the core files of OpenCart without actually editing the files, leaving your core untouched and ready to upgrade.

Unfortunately, when you are running a function to update the cache of OCmod, OpenCart will first set your store into Maintenance Mode, then complete the generation of OCmod cache, and, if everything is successful, will revert back and turn off Maintenance Mode.

And here is the catch.

If you have a corrupt OCmod file or too many OCmod modifications, your server may run out of time, not completing the script and leaving your store in Maintenance Mode without you even knowing it.

You won't see that the site is in Maintenance Mode because you will be logged in as Admin, but for your visitors and Search bots your site is closed. You lose sales and you are out of search results.


How to stop OpenCart Maintenance Mode to turn on automatically


So here is the fix: just comment out the line which turns it on Maintenance Mode in OCmod Cache generation.

in OC v2.x go to admin/controller/extension/modification.php

in OC v.3.x go to admin/controller/marketplace/modification.php

and remove this line of code $this->model_setting_setting->editSettingValue('config', 'config_maintenance', true);

And you are done. Just remember that after Upgrading your OpenCart, you will need to repeat this process.

OpenCart Refactoring Service

But, at the end of the day, you should keep your OCmod files clean and working. You should not have too many OCmod files. If you have an issue with this, send us a request and a developer will offer you one of our services of OpenCart Refactoring.

Our developers will review your codebase, tell you which OCmod files are corrupt and offer possible solutions.

To get a quote for OpenCart refactoring Service, simply contact us via the button below.

Not sure where to start?

If you are just starting and need a push, just send us a message.
We will happily point you in the right direction.

Talk to a developer