/** * Runs the item stock import cronjob. * * @param Shopware_Components_Cron_CronJob $Job */ public function runItemStockImport(Shopware_Components_Cron_CronJob $Job) { $this->Config->setImportItemStockLastRunTimestamp(time()); $this->Config->setImportItemStockNextRunTimestamp(time() + $Job->getJob()->getInterval()); if (!$this->Status->maySynchronize()) { $this->Config->setImportItemStockStatus(0); return; } try { PlentymarketsImportController::importItemStocks(); $this->Config->setImportItemStockStatus(1); $this->Config->eraseImportItemStockError(); } catch (Exception $E) { $this->Config->setImportItemStockStatus(2); $this->Config->setImportItemStockError($E->getMessage()); } }