diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php index 796fb7aa..ca811aba 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php @@ -34,8 +34,14 @@ class GroupsPriceController extends ActionController { public function indexAction(Hotel $hotel) { + // Sort configs by date to properly determine earliest date in js component + $configs = $hotel->getGroupsPriceConfigs()->toArray(); + uasort($configs, function ($a, $b) { + return $a->getDateFrom() > $b->getDateFrom(); + }); + $this->view->assign('hotel', $hotel); - $this->view->assign('configs', json_encode($hotel->getGroupsPriceConfigs()->toArray())); + $this->view->assign('configs', json_encode($configs)); $this->view->assign('boards', json_encode($hotel->getGroupsPriceBoards()->toArray())); $this->view->assign('options', json_encode($hotel->getGroupsPriceOptions()->toArray())); } diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php b/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php index 78df9083..8c668657 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/ProductController.php @@ -143,7 +143,8 @@ class ProductController extends ActionController } // Use first hotel which should be the only one at this point if ($product->getHotels()->count() > 0) { - $hotel = reset($product->getHotels()->toArray()); + $hotels = $product->getHotels()->toArray(); + $hotel = reset($hotels); } }