test
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • gabrielcapi Friend
    #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 Friend
    #529294

    You 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:


    1. mod_jak2filter_setting
    gabrielcapi Friend
    #533369

    The 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?

    gabrielcapi Friend
    #533868

    Anybody 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 Friend
    #533958

    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:
    [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]

    gabrielcapi Friend
    #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 Friend
    #534088

    Your 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]

    gabrielcapi Friend
    #534382

    Nice, thank you so much! 🙂

Viewing 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