Home › Forums › WoodMart support forum › Limit number of Search results
Limit number of Search results
- This topic has 7 replies, 2 voices, and was last updated 6 years, 10 months ago by
Artem Temos.
-
AuthorPosts
-
July 13, 2018 at 4:59 am #67260
wanilaParticipantHello.
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.jpgJuly 13, 2018 at 6:23 am #67278
Artem TemosKeymasterHi,
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; }
July 13, 2018 at 7:42 am #67285
wanilaParticipantThank 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?July 13, 2018 at 7:50 am #67287
Artem TemosKeymasterSorry, but this option is available in the latest version only.
July 13, 2018 at 9:09 am #67292
wanilaParticipantOh 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 🙁July 13, 2018 at 9:43 am #67299
Artem TemosKeymasterTry to edit the file
inc/template-tags.php
and replace this line$count = ( $header_search == 'dropdown' ) ? 20 : 40;
with this one
$count = 3;
July 13, 2018 at 7:20 pm #67375
wanilaParticipantThank you so much.
how can i limit the number of search results in mobile too? this code only works for desktop users. thank you
July 13, 2018 at 7:32 pm #67388
Artem TemosKeymasterTry to change the number in this line also
$ajax_args = apply_filters( 'woodmart_ajax_search_args', array( 'thumbnail' => 1, 'price' => 1, 'count' => 20 ) );
-
AuthorPosts
- You must be logged in to create new topics. Login / Register