No Code Attached Yet Information Required bug
avatar pixelhexe
pixelhexe
28 Feb 2024

Steps to reproduce the issue

  1. Backend: Create a search filter (e.g. search only articles in specific categories)
  2. Create a search menu item with this search filter
  3. Create a second search menu item without this search filter (because you need these two search possibilities on different parts of your website)
  4. Frontend: Search with menu item without search filter - results are ok
  5. Search with menu item with search filter - results are ok
  6. Search again with menu item without search filter - results are not ok because the search filter ID is still in the query string of the results URL ("...?q=your-search-word&f=1").

Expected result

Search results should always work without filter if no filter is assigned to the menu item.

Actual result

Search results do not work without filter if you did another search with filter previously.

System information (as much as possible)

Joomla 4.4.3, PHP 8.1

Additional comments

A fix would be to delete the "f" variable in the query string if no filter is assigned to the search menu item:

components\com_finder\src\Helper\RouteHelper.php

public static function getSearchRoute($f = null, $q = null) {
...
// Add the pre-defined search filter if present.
if ($f !== null) {
$uri->setVar('f', $f);
}
// MY CODE ADDITION
else {
$uri->delVar('f');
}
// END OF MY CODE ADDITION
...
}

avatar pixelhexe pixelhexe - open - 28 Feb 2024
avatar joomla-cms-bot joomla-cms-bot - change - 28 Feb 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Feb 2024
avatar Hackwar Hackwar - change - 26 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 26 Mar 2024
avatar Hackwar
Hackwar - comment - 14 Sep 2024

Please check if this is solved in joomla 5 and maybe also with #44055.

avatar Quy Quy - change - 14 Sep 2024
Labels Added: Information Required
avatar Quy Quy - labeled - 14 Sep 2024

Add a Comment

Login with GitHub to post a comment