diff --git a/web/typo3conf/ext/ep_products/Classes/Command/ProductCommandController.php b/web/typo3conf/ext/ep_products/Classes/Command/ProductCommandController.php index 4c820d75..2637c647 100644 --- a/web/typo3conf/ext/ep_products/Classes/Command/ProductCommandController.php +++ b/web/typo3conf/ext/ep_products/Classes/Command/ProductCommandController.php @@ -27,18 +27,42 @@ namespace EP\EpProducts\Command; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use EP\EpProducts\Service\ImportService; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\Controller\CommandController; +use TYPO3\CMS\Extbase\Service\CacheService; class ProductCommandController extends CommandController { /** * @var \EP\EpProducts\Service\ImportService - * @inject */ protected $importService; + /** + * @var CacheService + */ + protected $cacheService; + + /** + * @var ConfigurationManagerInterface + */ + protected $configurationManager; + + /** + * @param ImportService $importService + * @param CacheService $cacheService + * @param ConfigurationManagerInterface $configurationManager + */ + public function __construct(ImportService $importService, CacheService $cacheService, ConfigurationManagerInterface $configurationManager) + { + $this->importService = $importService; + $this->cacheService = $cacheService; + $this->configurationManager = $configurationManager; + } + public function importCommand() { $path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport'); @@ -47,7 +71,22 @@ class ProductCommandController extends CommandController } else { $count = $this->importService->import($path); $this->outputLine('%d rows imported.', [ $count ]); + $settings = $this->getSettings(); + $resellerPageUid = $settings['resellerExportPageUid']; + $this->cacheService->clearPageCache($resellerPageUid); } } + /** + * @return array + */ + protected function getSettings() + { + $settings = $this + ->configurationManager + ->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); + + return $settings['plugin.']['tx_epproducts.']['settings.']; + } + } diff --git a/web/typo3conf/ext/ep_products/Classes/Controller/BackendController.php b/web/typo3conf/ext/ep_products/Classes/Controller/BackendController.php index b9a6ed8e..d9fe1203 100644 --- a/web/typo3conf/ext/ep_products/Classes/Controller/BackendController.php +++ b/web/typo3conf/ext/ep_products/Classes/Controller/BackendController.php @@ -83,6 +83,8 @@ class BackendController extends ActionController } else { $dateCount = $this->importService->import($path); $this->addFlashMessage($dateCount . ' Termine importiert', 'Import abgechlossen', AbstractMessage::OK); + $resellerPageUid = $this->settings['resellerExportPageUid']; + $this->cacheService->clearPageCache($resellerPageUid); } $this->redirect('index'); } diff --git a/web/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php b/web/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php index 6909bfb5..1fd5aae4 100644 --- a/web/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php +++ b/web/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php @@ -74,6 +74,7 @@ class ResellerController extends ActionController /** * @param Reseller $reseller * @param Product $product + * @return bool * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException */ @@ -84,13 +85,14 @@ class ResellerController extends ActionController } $data = $this->resellerService->preprocessSingle($product); - var_dump($data);exit; - //TODO: Implement Excel sheet generation + var_dump($data); + + return false; } /** * @param Reseller $reseller - * @return mixed + * @return bool */ public function xmlAction(Reseller $reseller) { @@ -103,10 +105,9 @@ class ResellerController extends ActionController $serializer = new Serializer($normalizers, $encoders); - header('Content-type: text/xml;charset=utf-8'); - echo $serializer->serialize($data, 'xml', [ 'xml_encoding' => 'utf-8', 'xml_format_output' => true ]); - exit; + + return false; } }