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

View File

@@ -266,7 +266,9 @@
<span class="clearfix"></span>
</div>
</div>
<hr class="separator-hr-mg-10">
{if $product->available_for_order}
<hr class="separator-hr-mg-10">
{/if}
{else}
<input type="hidden" class="service_product_qty" id="service_product_qty" name="service_product_qty" data-id-product="{$product->id}" data-max_quantity="1" value="1">
{/if}