From 74265b07817741c6b1d48f7db42db30929444cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 3 Mar 2020 12:21:00 +0100 Subject: [PATCH] Calculate minprice based on availabilty --- .../ep_products/Classes/Domain/Repository/ProductRepository.php | 1 + .../ext/ep_products/Classes/Service/DateImportService.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php index b3c7b967..453a3876 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Repository/ProductRepository.php @@ -165,6 +165,7 @@ class ProductRepository extends AbstractRepository ->addGroupBy('date.hotel') ->addGroupBy('date.date_start') ->addGroupBy('date.nights') + ->having('available > 0') ->orderBy('important', 'DESC') ->addOrderBy('concept_sorting') ->addOrderBy('date_start') diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index c04d519b..adf410c3 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -561,7 +561,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface $pax = (int) $roomXml->attributes()['MaxPax']; $availableTotal += $available * $pax; - if ($code !== static::CODE_BABYROOM && ($minPrice === 0 || $price < $minPrice)) { + if ($code !== static::CODE_BABYROOM && $available > 0 && ($minPrice === 0 || $price < $minPrice)) { $minPrice = $price; }