-
AuthorPosts
-
April 2, 2014 at 7:54 pm #196389
Hi there, im a newbie using this plugin.
Somebody know if its possible have menu section with a K2 Search module where dont show results or items until you use the Search module.
I mean something like this:
http://107.6.188.194/~global74/index.php/capacitacion/buscar-certificados
But without the items below the search module.
and just if you know, how can i change the results to show just the item tittle.
Thank you so much, i appreciate your time.
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
April 3, 2014 at 2:56 am #529294You can try this workaround: create 2 separate menu items, one used to display search form only (published on main menu) and one for result page (hide this menu item from your main menu).
Once menu items are created, open the setting form of JA K2 filter module, under Menu assignment section, you need select to display on these menu items. And in “Menu Item ID” setting, you need select the menu item that is configured to display the result page, see screenshot below:
May 2, 2014 at 9:41 pm #533369The problem is when i left the filed in blank and press search, because appears all the items.
I want to force a search to show the items, creating a lightly protection to the items.
Do you know its possible do something like that?
May 6, 2014 at 4:59 pm #533868Anybody know how to hide all the items even if they leave the search box blank, this to avoid show all the items just pressing search. :(( :((
Thanks.
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
May 7, 2014 at 7:32 am #533958Sorry, I got your question wrong.
To hide all items if user does not select any search condition, please try solution below:
– Open the file:
components/com_jak2filter/models/itemlist.php– Find the code snippet:
[PHP]case ‘search’ :
$badchars = array(‘#’, ‘>’, ‘<‘, ‘\’);
$search = JString::trim(JString::str_ireplace($badchars, ”, JRequest::getString(‘searchword’, null)));
$sql = $this->prepareSearch($search);
if (!empty($sql))
{
$query .= $sql;
}break;[/PHP]
– And replace it with:
[PHP]case ‘search’ :
$badchars = array(‘#’, ‘>’, ‘<‘, ‘\’);
$search = JString::trim(JString::str_ireplace($badchars, ”, JRequest::getString(‘searchword’, null)));
$sql = $this->prepareSearch($search);
if (!empty($sql))
{
$query .= $sql;
} else {
$query .= ‘ AND 0 ‘;
}break;[/PHP]
May 7, 2014 at 3:27 pm #534024<em>@Dead Code 425737 wrote:</em><blockquote>Sorry, I got your question wrong.
To hide all items if user does not select any search condition, please try solution below:
– Open the file:
components/com_jak2filter/models/itemlist.php– Find the code snippet:….
</blockquote>Well, thanks for your answer i already tried but didn’t works.
You can see how works on my test website:
http://107.6.188.194/~global74/index.php/capacitacion/buscar-certificados
i press search with the field on blank and i still getting all the results.
Do you know another code or search module to do this?
Thank you so much 🙂
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
May 8, 2014 at 2:14 am #534088Your module is configured to filter item from only some specific categories, so by default, user request is always included a search condition of category. That’s why above code does not work.
So, please try to update such code as follows:
[PHP]case ‘search’ :
$badchars = array(‘#’, ‘>’, ‘<‘, ‘\’);
$search = JString::trim(JString::str_ireplace($badchars, ”, JRequest::getString(‘searchword’, null)));
$sql = $this->prepareSearch($search);$test = array_diff(array_keys($_GET), array(‘option’, ‘view’, ‘task’, ‘isc’, ‘Itemid’, ‘category_id’, ‘ordering’, ‘limit’, ‘start’));
if (!empty($sql) && !empty($test))
{
$query .= $sql;
} else {
$query .= ‘ AND 0 ‘;
}break;[/PHP]
May 9, 2014 at 4:11 pm #534382Nice, thank you so much! 🙂
AuthorPostsViewing 8 posts - 1 through 8 (of 8 total)This topic contains 8 replies, has 2 voices, and was last updated by gabrielcapi 10 years, 6 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
How hide items until search?
Viewing 8 posts - 1 through 8 (of 8 total)