Home Forums WoodMart support forum Limit number of Search results

Limit number of Search results

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #67260

    wanila
    Participant

    Hello.

    1. I want to limit the number of products in ajax searches ..
    When user click on the search button in header and search some words, it shows a lots of products ..
    How can i limit that number to 3? ( for both desktop and mobile users )

    2. In related products section, when user open my website with a tablet, there is 3 products appears in there. how can i change that to 2 products?
    http://s6.uplod.ir/i/00929/hepmn0sliurb.jpg

    #67278

    Artem Temos
    Keymaster

    Hi,

    1. Find this element in our header builder and decrease the number of results https://gyazo.com/f00fea2ac66f70b62ce2e20f9f9b5afd

    2. Sorry, but they are calculated automatically for all carousels on your website. If you will change it to 2 products, all similar carousels will be changed accordingly. Try to use this code and add it to the functions.php file in the child theme

    	function woodmart_get_owl_items_numbers( $slides_per_view, $post_type = false ) {
    		$items = array();
    		$items['desktop'] = ( $slides_per_view > 0 ) ? $slides_per_view : 1;
    		$items['desktop_small'] = ( $items['desktop'] > 1 ) ? $items['desktop'] - 1 : 1;
    		if ( $items['desktop'] == 6 ) $items['desktop_small'] = 4;
    		$items['tablet'] = 2;// ( $items['desktop_small'] > 1 ) ? $items['desktop_small'] : 1;
    		$items['mobile'] = ( $items['tablet'] > 2 ) ? $items['tablet'] - 2 : 1;
    
    		if ( $items['mobile'] > 2 ) {
    			$items['mobile'] = 2;
    		}
    
    		if ( $post_type == 'product' ) {
    			$items['mobile'] = woodmart_get_opt( 'products_columns_mobile' );
    		}
    
    		return $items;
    	}
    #67285

    wanila
    Participant

    Thank you so much.

    1. I use the woodmart 1.10.1 version
    could you please tell me how can i edit the number of results in there?

    #67287

    Artem Temos
    Keymaster

    Sorry, but this option is available in the latest version only.

    #67292

    wanila
    Participant

    Oh God 🙁
    This is the last day of my support
    Right now i don’t even know if there is any limit for my website search results or no!?
    cause lots of my future products are with same names, and if a user for example search for “WATCH” word, then there will be hundreds of products with name “WATCH” in search results.
    Pleaseeeee help 🙁

    #67299

    Artem Temos
    Keymaster

    Try to edit the file inc/template-tags.php and replace this line

    $count = ( $header_search == 'dropdown' ) ? 20 : 40;

    with this one

    $count = 3;

    #67375

    wanila
    Participant

    Thank you so much.

    how can i limit the number of search results in mobile too? this code only works for desktop users. thank you

    #67388

    Artem Temos
    Keymaster

    Try to change the number in this line also

    $ajax_args = apply_filters( 'woodmart_ajax_search_args', array( 'thumbnail' => 1, 'price' => 1, 'count' => 20 ) );

Viewing 8 posts - 1 through 8 (of 8 total)