From 3353fdfd31e64787d1333aff5fce3fc6a8c269e6 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Wed, 27 Sep 2023 15:40:38 +0530 Subject: [PATCH] update room type default date to when LOS is applied --- controllers/front/ProductController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 95c1e7553..4966c01cf 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -327,10 +327,16 @@ class ProductControllerCore extends FrontController if (!($date_from = Tools::getValue('date_from'))) { $date_from = date('Y-m-d'); - $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from))); + // set date to according to los + $objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange(); + $los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from); + $date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from))); } if (!($date_to = Tools::getValue('date_to'))) { - $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from))); + // set date to according to los + $objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange(); + $los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from); + $date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from))); } $hotel_branch_obj = new HotelBranchInformation($hotel_id);