Viewing 30 posts - 1 through 30 (of 39 total)
  • Author
    Posts
  • #1222162

    Hi,
    When a research gives a lot of results, they are not all visible on the page and so, the “See all results” button is not available (see screenshot in private content).
    Could you please tell me how I can limit the number of displayed results?
    If needed, you can find a link and credentials to my website in private content.
    Thanks a lot!

    #1223068

    Hey fcp,

    Please have a look at the following article:

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #1223755

    Hi Victoria,
    Thanks for your reply.
    I had a look to the article but I think it deals with changing the number of results per page.
    This is not what I need here.
    The only thing I need is limiting the number of results under the search bar in the main menu, as shown on the screenshot.

    #1223862

    Hi fcp,

    Please have a look at the following thread:
    https://kriesi.at/support/topic/limit-ajax-search-results-with-relevanssi/#post-404320

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #1224185

    Hi Victoria,
    Thanks for your reply.
    The last code given by Josue could be a solution for me:

    .ajax_search_response {
        max-height: 300px;
        overflow-y: scroll;
    }

    …but I would need to make the scrolling bar always visible.
    Which code do I need to add to achieve this?
    Thanks a lot!

    #1224681

    Hi,

    Try adding the following as well:

    overflow:visible

    Best regards,
    Jordan Shannon

    #1224741

    Hi Jordan,
    I’m sorry but your code doesn’t work at all.
    It only shows what needs to be hidden…

    #1224792

    Hey,

    I added following code to bottom of Quick CSS field

    #top #searchform .ajax_search_response {
        max-height: 300px;
        overflow-y: scroll;
    }

    Please review your website :)

    Best regards,
    Yigit

    #1224879

    Hi Yigit,
    I already added this code given by Josue in the mentioned topic.
    What I would need now is making the scrolling bar (see screenshot in private content) always visible, to make understand to the user that the submenu can be scrolled.
    Thanks!

    #1224897

    Hi,

    This is default browser behaviour. There should be workarounds like the one I attached in private content field however unfortunately, such customizations would be out of the scope of our support :)

    Best regards,
    Yigit

    #1224969

    Oh really ? :-( Ok!
    And there really is no CSS solution to show only 5 or 6 products in the search results and “Show more results” button at the end?

    #1225253

    Hi fcp,

    It’s not the css that gets the work done in this case, it’s php, JavaScript, html and css.

    Best regards,
    Victoria

    #1225307

    you do not want to limit the number on the search results page – only on the preview in the ajax search ?

    put this to your child-theme functions.php:

    add_filter('avf_ajax_search_query', 'avf_modify_ajax_search_query', 10, 1);
    function avf_modify_ajax_search_query($search_parameters){
    	parse_str($search_parameters, $params);
    	$params['numberposts'] = 5;
    	$search_parameters = http_build_query($params);
    	return $search_parameters;
    }

    to limit the results per page on the search-results page there are some codes here on the board. To get rid of the pagination with css is easy.

    #1225365

    Hi Guenni,
    Thanks for your reply.
    Only on the preview in the ajax search, that’s exactly what I need.
    I’m sorry but this function doesn’t work for me :-(

    #1225369

    and you inserted it to your child-theme functions.php ?
    and you are shure ? All caching tools resettet? all merging refreshed? All browser cache deleted? etc. pp

    see here my test page: https://webers-testseite.de/
    Limit set to 3
    search for youtube or masonry Then see the results page

    #1225383

    Sure :-(
    I did everything you mentioned. I also tried on another browser.
    But it doesn’t work.

    #1225408

    But as you can see on my test installation – that is what you like to have.
    And you have the normal implemented Search function of Enfold – or do you have relevansi or something else on start?
    Try to deactivate all your plugins to see if there is something hampering that function. On my testpage it is Enfold 4.7.5.

    #1226248

    Hi Guenni,

    Thanks for your reply.
    The issue came from Relevanssi extension. I deactivated it and your function works.

    But I need Relevanssi for other actions.
    Do you think your code can be adjusted to work with it?
    Or maybe Relevanssi settings??

    Thanks a lot!

    #1226687

    Hi,

    You can try the snippets provided in the following documentation to limit the number of items in the AJAX search results.

    // https://www.relevanssi.com/knowledge-base/posts-per-page/

    And you will have to implement this as well.

    // https://kriesi.at/documentation/enfold/search/#use-relevanssi-in-search-instead-of-the-default-search

    Best regards,
    Ismael

    #1227351

    Hi Ismael,
    Thanks for your reply.
    Once again, limiting posts per page is not what I need and this documentation seems to deal with that.
    I only need to limit search results in the menu.
    But since some days, I now have a bigger problem! Absolutely no result is displayed in the search bar and I don’t know what happened :-(

    #1228197

    Hi,

    limit search results in the menu.

    The snippets in the documentation will also limit the number of results displayed in the AJAX search. Just make sure that you’re using the relevanssi_do_query filter or function instead of the default get_posts function used in the theme.

    Add this snippet first to replace the default posts function:

    add_filter('avf_ajax_search_function', 'avia_init_relevanssi', 10, 4);
    function avia_init_relevanssi($function_name, $search_query, $search_parameters, $defaults)
    {
        $function_name = 'avia_relevanssi_search';
        return $function_name;
    }
    
    function avia_relevanssi_search($search_query, $search_parameters, $defaults)
    {
        global $query;
        $tempquery = $query;
        if(empty($tempquery)) $tempquery = new WP_Query();
    
        $tempquery->query_vars = $search_parameters;
        relevanssi_do_query($tempquery);
        $posts = $tempquery->posts;
    
        return $posts;
    }
    

    .. then include this to limit the number of results:

    add_filter( 'relevanssi_modify_wp_query', 'rlv_postsperpage' );
    function rlv_postsperpage( $query ) {
        $query->query_vars['posts_per_page'] = 5;
        return $query;
    }

    Best regards,
    Ismael

    #1229506

    Hi Ismael,
    Thanks for your reply.

    I gonna try your function later and I will have some questions about it.
    But for now, I absolutely need to make my search dropdown visible again.

    I tried many things:
    – disable all added functions related to search in my functions.php file
    – disable all added CSS related to search in my style.css file
    – delete searchform.php file I added in my child theme to transform the classic theme search to WooCommerce products search
    – deactivate Relevanssi extension
    …but there’s nothing to do. The search dropdown is still hidden and I don’t know why!

    I worry a lot about this because I will need to put my website online in the next weeks :-(

    Do you have an idea of what happened? Could you please help me on this?

    #1230277

    Hi,

    Sorry for the delay. We get a 500 internal server error whenever we try to search for posts. Did you modify the funtions-enfold.php file before? This file contains the AJAX search function (avia_ajax_search). We also tried to implement the Relevanssi function but it’s still not working.

    Please post the FTP details in the private field so that we can check the issue further.

    Best regards,
    Ismael

    #1230475

    Hi Ismael,
    Thanks for your reply.
    No, I didn’t modify the functions-enfold.php file.
    As I told you before, I only added a searchform.php file in my enfold-child folder, to transform the classic search to WooCommerce search.
    But for now I deleted it to try to find the reason of the display issue. I will put it back in the folder when the issue will be solved.
    Please find FTP details in private content.
    Best regards.

    #1230600

    Hey!

    Thank you for that info.

    As I told you before, I only added a searchform.php file in my enfold-child folder, to transform the classic search to WooCommerce search.

    That is actually the problem. The script used for the AJAX search depends on the markup inside that form, so you have to revert it back to default if you want to make the AJAX search work again. Unfortunately, you can’t use both WooCommerce and the theme’s default search.

    Best regards,
    Ismael

    #1230773

    Hi Ismael,
    I understand this and I do not want to use both WooCommerce and the theme’s default search.
    Now my custom searchform.php file is not anymore in my enfold-child folder, so I think searchform.php from the theme’s folder must be the reference now and search must work correctly, but it doesn’t.
    Furthermore, with adding my custom searchform.php file, search used to work perfectly before. I don’t know why it doesn’t work anymore now…

    #1231130

    Hi,

    We get an error whenever we try to access the file server.

    Error: Received unexpected end-of-file from SFTP server
    Error: Could not connect to server

    Please contact your hosting provider and ask them if they could configure the SFTP account properly.

    The following link contains the default searchform.php file.

    // https://pastebin.com/LudYKGHw

    Best regards,
    Ismael

    #1231307
    This reply has been marked as private.
    #1231553

    Hi Ismael,
    For information, I tried to completely delete functions.php and style.css from my child theme, but it still doesn’t work…

    #1231681

    Hi,

    We get an internal server error 500 whenever we try to search for posts but we are not yet sure why. The site takes quite a while to load and sometimes the image sets are blocked when we check the Network resources, so we can’t debug the site properly. The only difference that we noticed is that the site is using HTTP/2 protocol instead of the default HTTP/1, which is odd because the new protocol is supposed to improve the loading speed of the site. Did you configure the Apache server to use HTTP/2?

    Is there a staging or development version of the site? We would like to be able to disable the plugins while doing some tests.

    Thank you for your patience.

    Best regards,
    Ismael

Viewing 30 posts - 1 through 30 (of 39 total)
  • You must be logged in to reply to this topic.