Fix PHP warning issue in catalog mode

This commit is contained in:
Abhishek Kumar
2023-04-06 16:55:44 +05:30
parent e3d4e5fafd
commit 1683007770

View File

@@ -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']
);
}
}
}
}