Site logo

[Support request] Generatepress + GP premium and search result in woocomerce

Home Forums Support [Support request] Generatepress + GP premium and search result in woocomerce

Home Forums Support Generatepress + GP premium and search result in woocomerce

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

    Don’t see add to basket button and price.

    #1791111
    David
    Staff
    Customer Support

    Hi there,

    are you using the Navigation Search ?
    If so the snippet here will change its behaviour to display product search results:

    https://docs.generatepress.com/article/generate_navigation_search_output/#woocommerce-products

    #1791480
    Artur

    yes I use navigation search how to fix it

    #1791482
    David
    Staff
    Customer Support

    In this link:

    https://docs.generatepress.com/article/generate_navigation_search_output/#woocommerce-products

    Under Woocommerce Products – add that PHP Snippet to your site.
    This doc explains how to add PHP:

    https://docs.generatepress.com/article/adding-php/

    #1791492
    Artur

    I use this

    add_filter (‘generation_navigation_search_output’, function () {
    printf (
    ‘<form method = “get” class = “search-form navigation-search” action = “% 1 $ s”>
    <input type = “search” class = “szukaj -field “value =”% 2 $ s “name =” s “title =”% 3 $ s “/>
    <input type =” hidden “name =” post_type “value =” product “/>
    </form> ‘ ,
    esc_url (home_url (‘/’)),
    esc_attr (get_search_query ()),
    esc_attr_x (‘Search’, ‘label’, ‘generatedpress’)
    );
    });

    #1791494
    Artur

    but not working https://meblowykramik.pl

    #1792060
    Artur

    David have some problem with that

    https://docs.generatepress.com/article/generate_navigation_search_output/#woocommerce-products

    1. Place holder

    When I add that code need 2 click to enter text. Without that 1 click.

    add_filter( ‘generate_navigation_search_output’, function() {
    printf(
    ‘<form method=”get” class=”search-form navigation-search” action=”%1$s”>
    <input type=”search” placeholder=”Enter your search” class=”search-field” value=”%2$s” name=”s” title=”%3$s” />
    </form>’,
    esc_url( home_url( ‘/’ ) ),
    esc_attr( get_search_query() ),
    esc_attr_x( ‘Search’, ‘label’, ‘generatepress’ )
    );
    } );

    #1792066
    Elvin
    Staff
    Customer Support

    Hi there,

    Have you added multiple snippets of the same generate_navigation_search_output filter?

    Last time I checked I saw your site is rendering multiple search forms.

    Do you want the search function to search WooCommerce product AND have the search bar get a placeholder text?

    If so, we can rewrite the code coming from that documentation into a single filter.

    Example:

    add_filter( 'generate_navigation_search_output', function() {
        return sprintf(
            '<form method="get" class="search-form navigation-search" action="%1$s">
                <input type="search" placeholder="Enter your search" class="search-field" value="%2$s" name="s" title="%3$s" />
                <input type="hidden" name="post_type" value="product" />
            </form>',
            esc_url( home_url( '/' ) ),
            esc_attr( get_search_query() ),
            esc_attr_x( 'Search', 'label', 'generatepress' ) 
        ); 
    } );

    This is how it will behave – https://share.getcloudapp.com/WnuYL8K7

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