Skip to content

Commit 035e793

Browse files
authored
Merge pull request #758 from abhishek-webkul/gli-777
Redirect to Page not found for invalid search results page URL
2 parents 2f66994 + aff9968 commit 035e793

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

controllers/front/CategoryController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function initContent()
211211
'order_date_restrict' => $order_date_restrict
212212
));
213213
} else {
214-
Tools::redirect($this->context->link->getPageLink('index'));
214+
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
215215
}
216216

217217
$feat_img_dir = _PS_IMG_.'rf/';

modules/wkhotelfilterblock/wkhotelfilterblock.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ public function hookDisplayLeftColumn()
6464
if ($this->context->controller->php_self == 'category') {
6565

6666
$htl_id_category = Tools::getValue('id_category');
67-
if (Validate::isLoadedObject($objCategory = new Category((int) $htl_id_category))) {
67+
if (Validate::isLoadedObject($objCategory = new Category((int) $htl_id_category))
68+
&& ($id_hotel = HotelBranchInformation::getHotelIdByIdCategory($htl_id_category))
69+
) {
6870
if ($objCategory->hasParent(Configuration::get('PS_LOCATIONS_CATEGORY'))) {
6971
Media::addJsDef(array('noRoomAvailTxt' => $this->l('No room available', false, true)));
7072

@@ -73,8 +75,6 @@ public function hookDisplayLeftColumn()
7375
$id_lang = $this->context->language->id;
7476
$all_feat = FeatureCore::getFeatures($id_lang);
7577

76-
$id_hotel = HotelBranchInformation::getHotelIdByIdCategory($htl_id_category);
77-
7878
$max_adult = HotelRoomType::getMaxAdults($id_hotel);
7979
$max_child = HotelRoomType::getMaxChild($id_hotel);
8080

modules/wkroomsearchblock/wkroomsearchblock.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ public function hookDisplayLeftColumn()
124124
{
125125
if ('category' == Tools::getValue('controller')) {
126126
$idCategory = Tools::getValue('id_category');
127-
if (Validate::isLoadedObject($objCategory = new Category((int) $idCategory))) {
127+
if (Validate::isLoadedObject($objCategory = new Category((int) $idCategory))
128+
&& HotelBranchInformation::getHotelIdByIdCategory($idCategory)
129+
) {
128130
if ($objCategory->hasParent(Configuration::get('PS_LOCATIONS_CATEGORY'))) {
129131
$objSearchHelper = new WkRoomSearchHelper();
130132
$objSearchHelper->assignSearchPanelVariables();

0 commit comments

Comments
 (0)