New Landing How can we help? Themeforest Theme Support Neighborhood How can I set up the home page' Search to "search product only"

Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • #130703
    gnajames
    Member
    Post count: 28

    Hi Neighbor;

    wondering how can I set up the home page’ Search to “search product only”? now when I search something, the products shown in the search result are more like a post (ie. has date, comment and like under the product name, and no price shows) rather than a product.

    Hope I make myself clear, please kindly advise.

    Thanks & Regards
    Johnny

    #130737
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste given below code at functions.php of child theme.

    function sf_main_menu($id, $layout = "") {
    	
    		// VARIABLES
    		$options = get_option('sf_neighborhood_options');
    		$show_cart = $options['show_cart'];
    		$show_wishlist = $options['show_wishlist'];
    		$disable_search = false;
    		if (isset($options['disable_search'])) {
    			$disable_search = $options['disable_search'];
    		}
    		$menu_output = $menu_full_output = "";
    		$main_menu_args = array(
    			'echo'            => false,
    			'theme_location' => 'main_navigation',
    			'fallback_cb' => ''
    		);
    		
    		
    		// MENU OUTPUT
    		if ($id == "mini-navigation") {
    		$menu_output .= '<nav id="'.$id.'" class="mini-menu clearfix">'. "\n";
    		} else {
    		$menu_output .= '<nav id="'.$id.'" class="clearfix">'. "\n";		
    		}	
    		if(function_exists('wp_nav_menu')) {
    			$menu_output .= wp_nav_menu( $main_menu_args );
    		}
    		$menu_output .= '</nav>'. "\n";
    		
    		
    		// FULL WIDTH MENU OUTPUT
    		if ($layout == "full") {	
    			$menu_full_output .= '<div class="container">'. "\n";
    			$menu_full_output .= '<div class="row">'. "\n";
    			$menu_full_output .= '<div class="span9">'. "\n";
    			$menu_full_output .= $menu_output . "\n";
    			$menu_full_output .= '</div>'. "\n";
    			$menu_full_output .= '<div class="span3 header-right">'. "\n";
    			if ($id == "mini-navigation") {
    			$menu_full_output .= '<nav class="mini-menu">'. "\n";
    			} else {
    			$menu_full_output .= '<nav>'. "\n";			
    			}
    			$menu_full_output .= '<ul class="menu">'. "\n";
    			if (!$disable_search) {
    			$menu_full_output .= '<li class="menu-search no-hover"><a href="#"><i class="fa-search"></i></a>'. "\n";
    			$menu_full_output .= '<ul class="sub-menu">'. "\n";
    			$menu_full_output .= '<li><div class="ajax-search-wrap"><div class="ajax-loading"></div><form method="get" class="ajax-search-form" action="'.home_url().'/shop/"><input type="text" placeholder="'.__("Search", "swiftframework").'" name="s" autocomplete="off" /></form><div class="ajax-search-results"></div></div></li>'. "\n";			
    			$menu_full_output .= '</ul>'. "\n";
    			$menu_full_output .= '</li>'. "\n";
    			}
    			if ($show_cart) {
    			$menu_full_output .= sf_get_cart();
    			}
    			if ( class_exists( 'YITH_WCWL_UI' ) && $show_wishlist)  {
    			$menu_full_output .= sf_get_wishlist();
    			}
    			$menu_full_output .= '</ul>'. "\n";
    			$menu_full_output .= '</nav>'. "\n";
    			$menu_full_output .= '</div>'. "\n";
    			$menu_full_output .= '</div>'. "\n";
    			$menu_full_output .= '</div>'. "\n";
    			
    			$menu_output = $menu_full_output;
    		}
    		
    		
    		// MENU RETURN		
    		return $menu_output;
    	}

    It will work as you want.
    Thanks
    Mohammad

    #130916
    gnajames
    Member
    Post count: 28

    Thanks Mohammad; just to confirm, do I add them in
    Custom CSS
    Quickly add some CSS to your theme by adding it to this textarea.”

    area? copy n paste? I am really a layman…

    #130945
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    You need to use a child theme and add to the functions.php file of the child theme

    – Kyle

    #133908
    Gierano
    Member
    Post count: 33

    Hi Kyle.

    If in search window click in bottom link “View all ### results” it return the page with non-product search result. Any way to fix it?

    Thanks!

    #134154
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    Please ignore all of the above, there’s now an option in the theme options to return only product search results

    – Kyle

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

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register