• Resolved alessandro37

    (@alessandro37)


    Hi Everyone!

    Just looking for some precious help, I’m getting crazy!
    I’ve installed Woocommerce and Smart Search plugins.

    The problem is that I would like to use as search result layout the template coded in archive-products.php (more consistent to Woocommerce Style) instead of the standard one, coded in search.php.

    I’ve also played on the plugin setting in:
    Smart Search > Custom Widget > Setting > Default Output on Search Page
    Smart Search > Custom Widget > Setting > Search Page Layout with Posts

    …but noting happened!

    So, what can I do?

    Really appreciate in advance your suggestions!!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author YummyWP

    (@yummy-wp)

    Hi there,

    That “Default Output on Search Page” and “Search Page Layout with Posts” options should be off. So default Woocommerce search results template should be displayed.
    But it seems that your theme functionality overwrides it, because default Woocommerce search results page do not display anything.
    https://www.luciecose.it/?s=casa&post_type=product

    Best
    Stanislav

    Thread Starter alessandro37

    (@alessandro37)

    Hi,

    Thanks for your reply.
    Just to let you know, I’m working in localhost now and I added in ,y child funtion this code:

    add_filter( 'pre_get_posts', 'search_by_product_only' );
    
        function search_by_product_only( $query ) {
    
            // check if search query only
            if ( $query->is_search ) {
    		
                $query->set( 'post_type', array( 'product') ); // here you can add multiple post types in whcih you want to search
            }
    
            return $query;
        }
    

    It seems working fine..

    Thanks again for your help!

    Plugin Author YummyWP

    (@yummy-wp)

    Hi,

    So now it is working as expected?
    That is great.

    Best
    Stanislav

    Thread Starter alessandro37

    (@alessandro37)

    Hi,

    Yes, it seems to work properly. I’ll run some other test once I’ll update the online website.

    Ciao!
    Alessandro

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search output layour’ is closed to new replies.