From ceff90c44bfbdd5f4fd0bde354aa16fec9d8c246 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 29 Mar 2025 15:50:32 +0530 Subject: [PATCH] Fixed: Should not show service products in the front office when Show at front office is disabled --- controllers/front/ProductController.php | 7 +++++-- themes/hotel-reservation-theme/_partials/booking-form.tpl | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 895b8f1d1..2616207a1 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -116,13 +116,16 @@ class ProductControllerCore extends FrontController $this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id); } + // redirect if the product is not available for front + if (!$this->product->show_at_front) { + Tools::redirect($this->context->link->getPageLink('pagenotfound')); + } + $objHotelRoomType = new HotelRoomType(); if ($hotelRoomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->product->id)) { $idHotel = (int) $hotelRoomInfo['id_hotel']; if (!HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) { Tools::redirect($this->context->link->getPageLink('pagenotfound')); - } else if (!$this->product->booking_product || ($this->product->booking_product && !$this->product->show_at_front)) { - Tools::redirect($this->context->link->getPageLink('pagenotfound')); } } diff --git a/themes/hotel-reservation-theme/_partials/booking-form.tpl b/themes/hotel-reservation-theme/_partials/booking-form.tpl index 83ab296a8..89d45595d 100644 --- a/themes/hotel-reservation-theme/_partials/booking-form.tpl +++ b/themes/hotel-reservation-theme/_partials/booking-form.tpl @@ -266,7 +266,9 @@ -
+ {if $product->available_for_order} +
+ {/if} {else} {/if}