From ce1aced6bec5395c838bbaf7f78f23c3c31759f0 Mon Sep 17 00:00:00 2001 From: Quazz Date: Tue, 8 Sep 2020 12:09:33 +0200 Subject: [PATCH] Add cron logic --- Cron/GenerateFile.php | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Cron/GenerateFile.php diff --git a/Cron/GenerateFile.php b/Cron/GenerateFile.php new file mode 100644 index 0000000..ce06ec4 --- /dev/null +++ b/Cron/GenerateFile.php @@ -0,0 +1,47 @@ +logger = $logger; + $this->filesystem = $filesystem; + $this->directoryList = $directoryList; + $this->csvProcessor = $csvProcessor; + $this->xmlFeed = $xmlFeed; + } + + /** + * Sync all products assigned to 'axitech' source to PCRT + * + * @return void + */ + public function execute() + { + try { + $fileDirectoryPath = $this->filesystem->getDirectoryWrite( + \Magento\Framework\App\Filesystem\DirectoryList::PUB + ); + $fileName = 'googleshopping.xml'; + + $xmldata = $this->xmlFeed->getFeed(); + $fileDirectoryPath->writeFile($fileName, $xmldata); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + } + } +}