From 16830077705a8832190ba8708596aac3ea9b2a4e Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 6 Apr 2023 16:55:44 +0530 Subject: [PATCH] Fix PHP warning issue in catalog mode --- .../hotelreservationsystem.php | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index c7f78a128..39422311b 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -73,23 +73,25 @@ class HotelReservationSystem extends Module date('d-m-Y', strtotime(date('Y-m-d', time()).' + 1 year')) ); } - /*To remove room from cart before todays date*/ - if (isset($this->context->cart->id) && $this->context->cart->id) { - $htlCart = new HotelCartBookingData(); - if ($cartBookingData = $htlCart->getCartBookingDetailsByIdCartIdGuest( - $this->context->cart->id, - $this->context->cart->id_guest, - $this->context->language->id - )) { - foreach ($cartBookingData as $cartRoom) { - if (strtotime($cartRoom['date_from']) < strtotime(date('Y-m-d'))) { - $htlCart->deleteRoomDataFromOrderLine( - $cartRoom['id_cart'], - $cartRoom['id_guest'], - $cartRoom['id_product'], - $cartRoom['date_from'], - $cartRoom['date_to'] - ); + if (!Configuration::get('PS_CATALOG_MODE')) { + /*To remove room from cart before todays date*/ + if (isset($this->context->cart->id) && $this->context->cart->id) { + $htlCart = new HotelCartBookingData(); + if ($cartBookingData = $htlCart->getCartBookingDetailsByIdCartIdGuest( + $this->context->cart->id, + $this->context->cart->id_guest, + $this->context->language->id + )) { + foreach ($cartBookingData as $cartRoom) { + if (strtotime($cartRoom['date_from']) < strtotime(date('Y-m-d'))) { + $htlCart->deleteRoomDataFromOrderLine( + $cartRoom['id_cart'], + $cartRoom['id_guest'], + $cartRoom['id_product'], + $cartRoom['date_from'], + $cartRoom['date_to'] + ); + } } } }