This topic has 11 replies, 4 voices, and was last updated 9 years, 6 months ago ago by Jack Richardson
Hi,
My client has used the default search widget in one of their sidebars, but the search function is only searching through the woocommerce products, not the rest of the site. I notice that the default search has been overwritten to search only products in searchform.php but this function already exists in woocommerce as the woocommerce product search widget (which is styled badly).
My client would like the user to be able to search within the site (mainly the blog) but also have the functionality of having a search for products. Should I rewrite the searchform.php in the child theme to search the entire site and rewrite the woocommerce product search to the same styles that the default search uses? Or is there a simpler way?
Thank you for your time.
Hello,
You can comment the line 13 <input type="hidden" name="post_type" value="product" />
in the file searchform.php and you’ll get default search form.
Please try it.
Best regards,
Jack Richardson.
For some reason commenting out that line results in the site losing its boxed layout. But the search works properly.
The <!– –> comment was breaking the layout, copying the file into the child theme and deleting the line worked though. Also using php tags and comments on the line worked without breaking.
How can I fix the layout of the woocommerce search products widget?
Hello,
Could you please show on a screenshot what you want to modify?
Thank you.
Regards,
Eva Kemp.
Basically, the search widgets look like this:
The standard search, modified by 8theme is:
‘Input Field’ ‘Button “Go”‘
This is inline and how it should look.
The woocommerce search is:
‘Input Field’
‘Button “Search”‘
This is on two lines and the button is hard up on the input box.
You can see the examples on the web site under the Shop section for the woocommerce widget and blog for the standard widget. Both are at the top left of the page.
Thank you.
Hello,
Please try to add the following code in custom.css file
.products-sidebar .woocommerce-product-search .search-field{
float: left;
width: 130px;
}
.products-sidebar .woocommerce-product-search input[type="submit"]{
float:right;
height: 27px;
}
Regards,
Robert Hall.
Thank you, for the start. I added the code, but made a few changes:
#products-sidebar .woocommerce-product-search .search-field{
width: 106px;
}
#products-sidebar .woocommerce-product-search input[type="submit"]{
margin-left:2px;
height: 28px;
}
products-sidebar is an id not a class and the width of the input was too wide so I brought it down to 106px, the same width as the 8theme search. But because of the value of the button “Search” as opposed to “Go”, it is too wide when viewed on a smaller device so it falls to the line below. I might have to look into overriding the search box with a custom widget and then I can use the same styles and values as the 8theme search keeping the search boxes the same.
Thanks again.
You can also try to use this code
#products-sidebar .woocommerce-product-search .search-field{
width: 68%;
}
#products-sidebar .woocommerce-product-search input[type="submit"]{
margin-left: 2px;
height: 28px;
float: right;
width: 30%;
}
Regards,
Robert Hall.
I used this method instead to get the “Go” button which fits a lot better:
http://docs.woothemes.com/document/overriding-the-product-search-box-widget/
Hello,
We are glad you have found the solution.
Let us know if you need further assistance.
Best regards,
Jack Richardson.
Tagged: customizable, search widget, seo friendly, themes, user friendly, woocommerce, wordpress
You must be logged in to reply to this topic.Log in/Sign up