Answer the question
In order to leave comments, you need to log in
Running the plugin on schedule (1 time per day)?
Good day to all.
Essence of the question: Opencart, SeoGen plugin. It looks like this - inputs, checkboxes, textarea + generate button.
It is necessary to generate this whole thing in the background once a day, at a certain time, the generate button (highlighted in red) calls the function with the argument + collects data from the fields.
Button code:
<a onclick="generate('products');" class="button">Генерировать</a>
public function generate() {
if($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['name']) && $this->validate()) {
$time_start = microtime(true);
$base_memory_usage = memory_get_usage();
$this->load->language('module/seogen');
$this->load->model('module/seogen');
$name = $this->request->post['name'];
if($name == 'categories') {
$this->model_module_seogen->generateCategories($this->request->post['seogen']);
} elseif($name == 'products') {
$this->model_module_seogen->generateProducts($this->request->post['seogen']);
} elseif($name == 'manufacturers') {
$this->model_module_seogen->generateManufacturers($this->request->post['seogen']);
} elseif($name == 'informations') {
$this->model_module_seogen->generateInformations($this->request->post['seogen']);
}
$this->response->setOutput($this->language->get('text_success_generation') . "</br><b>Total Execution Time:</b> ".(microtime(true) - $time_start).
"<br/>" . "<b>Memory usage:</b> ". number_format((memory_get_usage() - $base_memory_usage) /1024/1024, 2, '.', '') . "Mb");
$this->saveSettings($this->request->post['seogen']);
$this->cache->delete("seo_pro");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question