Fixed: Should not show service products in the front office when Show at front office is disabled

This commit is contained in:
Sumit Panwar
2025-03-29 15:50:32 +05:30
parent 63e7320992
commit ceff90c44b
2 changed files with 8 additions and 3 deletions

View File

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