Does anyone know enough about opencart?
I need to put a store in maintenance mode automatically, in this case every Saturday. I have already customized the maintenance page, I just need to leave it automatic.
Does anyone know enough about opencart?
I need to put a store in maintenance mode automatically, in this case every Saturday. I have already customized the maintenance page, I just need to leave it automatic.
You need to use CronJob.
Knowing this we can go to the code.
<?php
class ControllerToolMaintenance extends Controller {
public function index() {
//Aqui o OC vai verificar se a key está correta, isso vai ajudar a fazer com que terceiros não faça esse processo manual.
if (isset($this->request->get['key']) && $this->request->get['key'] = 'SUA_KEY') {
//Aqui o código vai ativar o modo manutenção.
$this->db->query('UPDATE ' . DB_PREFIX . 'setting SET config_maintenance = 1 WHERE key = "config_maintenance"');
}
}
public function normal() {
//Aqui o OC vai verificar se a key está correta, isso vai ajudar a fazer com que terceiros não faça esse processo manual.
if (isset($this->request->get['key']) && $this->request->get['key'] = 'SUA_KEY') {
//Aqui o código vai ativar o modo manutenção.
$this->db->query('UPDATE ' . DB_PREFIX . 'setting SET config_maintenance = 0 WHERE key = "config_maintenance"');
}
}
}
Just create this file in the catalog / controller / tool folder and save as maintenance.php
About the Cron: link