Viewing 10 replies - 1 through 10 (of 10 total)
  • I encounter the same problem just now (same theme). I notice on your site you have fixed the problem; could you share it with me?

    I’d be very grateful!

    Thread Starter apoteko

    (@apoteko)

    Nope unfortunately I haven’t fixed the problem. I just removed temporary the search from header of OXY theme and I installed as a widget the woo search on the sidebar. Alternatively it should be good if I could move on header the widget of woo search but I haven’t found a way yet to do it.

    Aha okay. Luckily I have found a solution meanwhile; might be interesting for you as well then.
    Add this to your functions.php:

    function search_results_product_type( $vars ) {
      if( isset( $_GET['s'] ) )
        $vars['post_type'] = "product";
       return $vars;
    }
    add_filter( 'request', 'search_results_product_type' );

    … and all the search requests will get product as post_type and thus results will be shown nicely.

    Thread Starter apoteko

    (@apoteko)

    I found the solution!

    You go to wordpress
    -Go to Appearance
    -Go to Editor
    -Select your themes main (not child) folder
    -Find the file called “header-area.php”

    Find the code in the 23 line

    <div class=”button-search”></div>
    <input type=”text” name=”s” id=”s” placeholder=”‘.__(‘Search’,’oxy’).'” value=”” />

    under there place the following
    <input type=”hidden” name=”post_type” value=”product”>

    Save and it works like a charm!

    Thread Starter apoteko

    (@apoteko)

    I am not sure which solutions is the best…
    I have edit the header, you have edit the functions. I am just thinking what happens with both solutions when we update? if it will lose the changes

    That solution I also tried, and worked, but I think the functions solution is better. Because when the Oxy theme has an update the hidden field will be gone again … And the functions one will always work!

    Thread Starter apoteko

    (@apoteko)

    where did you add it in the functions? in the end?

    Thread Starter apoteko

    (@apoteko)

    Do you know how to edit the images to crop the correct way? I am facing another problem with the images in woocommerce. I have some images that are different sizes for example: some are 320X450 some are 300X420
    The problem is that woo, generates images only when they are equal (square) otherwise it cuts and doesn’t display correct. You can see an example at https://www.apoteko.se the product called Solgar Omega 3-6-9.

    Have you faced similar problem? Have you found any solution?

    Doens’t matter where in the fuctions, just make sure its the functions.php file of your child theme ??

    I can’t find the product you are referring to in your products … But anyway, oxy indeed always crops in square ratio. Thus I have all my product photos made square as well, so there’s no problem. I don’t think there is another way around it …

    By the way, our two previous solutions for the search results was useless work after all … In the Oxy admin > General > Header is an option called ‘Enable product search’, which does exactly what we were looking for …
    But I guess we learned a lot from searching our way in the code ??

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