Home>Support>Replace Vantage search with Woocommerce search

Replace Vantage search with Woocommerce search

I’m wondering if is it possibile to make the search icon in Vantage menu acting like the search function of Woocommerce, which searches and display only the products of the store.

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 6 years, 10 months ago Andrew Misplon Hi, I Work Here

    Hi zeitan

    Good question for sure. We haven’t experimented with this before. I’d imagine you’d need to use a plugin, perhaps search for one and let us know if you find a good one:

    Perhaps this one?

    https://wordpress.org/plugins/advanced-custom-post-search/

  2. 6 years, 10 months ago zeitan

    There is a way to insert the shortcode of this plugin in the seach function of vantage?

  3. 6 years, 10 months ago Andrew Misplon Hi, I Work Here

    Unfortunately in this case you’d need to use that plugin in a widget area, insert the shortcode into a Text widget in the header, sidebar or footer widget areas.

  4. 6 years, 10 months ago zeitan

    Is it possible to make the vantage search form to call for another search function, overriding vantage one?

  5. 6 years, 10 months ago Andrew Misplon Hi, I Work Here

    It is with some custom development. You’d need to use a child theme, create a folder called “parts” in the child theme. Copy menu.php from /parts/ in the parent theme into the new parts folder in the child theme and then replace lines 8 through 15 with the PHP call to your new search function.

    It’s unfortunately a little beyond our scope here, we can advise on a high level like the above though.

  6. 6 years, 10 months ago zeitan

    Hi andrew, I’m trying to change the menu.php but it seems that the theme isn’t loading that file for the menu.
    I’m writing echoes everywhere but I can’t find them in the html.

  7. 6 years, 10 months ago Andrew Misplon Hi, I Work Here

    Which masthead layout are you using? If you’re using Logo in Menu then menu.php won’t be used, masthead-logo-in-menu.php will be used.

  8. 6 years, 10 months ago zeitan

    Thank you! I managed to merge the woocommerce function in Vantage but I have some graphic problems. Is searchform.php involved?

  9. 6 years, 10 months ago Andrew Misplon Hi, I Work Here

    Glad to hear you’ve made some progress. masthead-logo-in-menu.php has the code for the search form listed there, it’s not including searchform.php.

  10. 6 years, 7 months ago zeitan

    Unfortunatly I’m still working in local beacuse my client had a big hosting problem…

    Anyway I solved the search problem changing this in masthead-logo-in-menu.php :

     <?php if( siteorigin_setting('navigation_menu_search') ) : ?>
    				<div id="search-icon">
    					<div id="search-icon-icon"><div class="vantage-icon-search"></div></div>
    					<form method="get" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search" <?php echo get_search_form() ; ?>
    					</form>
    				</div>
    			<?php endif; ?>

    and adding this in my child functions.php :

     function woo_wc_search_form( $form ) {
    
        $form = '<li class="search"><form role="search" method="get" id="searchform" action="' . esc_url(home_url( '/' )) . '" >
    <input type="search" results=5 autosave="'. esc_url(home_url( '/' )) .'" class="input-text" placeholder="'. esc_attr__( 'Cerca', 'woothemes' ) .'" value="' . get_search_query() . '" name="s" id="s" />
        <input type="submit" class="submit" id="searchsubmit" value="'. esc_attr__( 'Search', 'woothemes' ) .'" />
        <input type="hidden" name="post_type" value="product" />
        </form></li>';
    
        return $form; 

    Now it works like a charm!
    Thank You Andrew!

  11. 6 years, 7 months ago Andrew Misplon Hi, I Work Here

    Hi Zeitan

    Nicely done! Thanks for taking the time to share your work on the forum, I’m sure others will find this thread useful.

    All the best.

  12. 4 years, 11 months ago Leonardo Normando

    Hello!

    I just come to another solution, that works with SiteOrigin North theme:

    Just add this to your functions.php file

    function searchfilter($query) {
    
        if ($query->is_search && !is_admin() ) {
            $query->set('post_type',array('product','product'));
        }
    
    return $query;
    }
    
    add_filter('pre_get_posts','searchfilter');
    

    In the line:

    $query->set('post_type',array('product','product'));

    You can specify the array of pages to show

    Thanks for all your excellent work!

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More