diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index 0f99a3b9..a95bb1dc 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -146,26 +146,14 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface public function parseXmlFilesForProducts($path) { - $xmlPath = sprintf('%s/Produkte.xml', $path); - - if (!file_exists($xmlPath)) { - $this->logger->error('product list xml not found'); - return 0; - } - - libxml_use_internal_errors(true); - /** @var \SimpleXMLElement $xmlData */ - if (!$xmlData = simplexml_load_string(file_get_contents($xmlPath))) { - libxml_clear_errors(); - return 0; - } - $dateCount = 0; - foreach ($xmlData->produkte[0]->children() as $xmlProdukt) { - $busProId = (int)$xmlProdukt->attributes()['id']; - $xmlFile = sprintf('%s/Ziel_%d.xml', $path, $busProId); - $dateCount += $this->parseProductXmlFile($xmlFile); + $folder = opendir($path); + while (($fileName = readdir($folder)) !== false) { + if (strpos($fileName, 'Ziel') === 0) { + $filePath = $path . '/' . $fileName; + $dateCount += $this->parseProductXmlFile($filePath); + } } return $dateCount;