working version
This commit is contained in:
1 parent
184cac66e6
commit
7e0aa41be6
11 files changed
+875
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
class EcomZoneCronTask extends ModuleGrid
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->name = 'ecomzone_cron';
|
||||
$this->title = $this->l('EcomZone Product Sync');
|
||||
$this->cron_frequency = 3600 * 2; // Run every hour
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Configuration::updateValue('ECOMZONE_LAST_CRON_RUN', '');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
try {
|
||||
EcomZoneLogger::log('Starting scheduled product sync');
|
||||
|
||||
$productSync = new EcomZoneProductSync();
|
||||
$result = $productSync->importProducts();
|
||||
|
||||
Configuration::updateValue('ECOMZONE_LAST_CRON_RUN', date('Y-m-d H:i:s'));
|
||||
EcomZoneLogger::log('Scheduled product sync completed', 'INFO', $result);
|
||||
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
EcomZoneLogger::log('Scheduled product sync failed', 'ERROR', ['error' => $e->getMessage()]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user