Score:-3

How do I add an exposed form to search products?

cn flag

I installed the Search API module and followed the documentation to set up an index and a search box using views and facets. It doesn't show an exposed form to search, even though there is a view and I can get a static grid of products. I set through the blocks where the exposed form should be, but it doesn't appear.

According to How to index Drupal Commerce 2 products for the search? the standard search doesn't show products, but the search block configuration seems to indicate that products can be shown.

search configure

sonfd avatar
in flag
Please add some more detailed information about what you did and link to the docs you say you followed. You say there's no exposed form even though you created a view, but did you add an exposed form to the view? Also, your screenshot seems to show a block configuration screen where you've configured the block to appear on certain product pages - which doesn't seem to have anything to do with the rest of your question.
cn flag
I used Acromedias howto at https://www.acromedia.com/article/creating-a-product-catalogue-with-search-api-solr-facets usinga Solr server - but it has language issues but will produce a form that does not display results and another from https://docs.drupalcommerce.org/commerce2/developer-guide/products/marketing-products/product-search using the database server which does not produce a search box but I can display a page of all products. apaderno changed the question into completely something OTHER than I am asking - I want a search box that will show BOTH content and products.
cn flag
I see from the last line that the "visibiity" setting in the config is an "exclusion" and not an "inclusion" setting
sonfd avatar
in flag
It's not clear what the block is that you're showing the visibility settings for. But if that is for the search form for your products list, you need to make sure it's set to display on the same page as the view you made, probably something like `/products`. Or it might be even easier to set your view to NOT expose the form in a block. In the Exposed form section of the Advanced settings, click the *Yes* link next to Exposed form in block to change the setting to *No*.
sonfd avatar
in flag
But these are all just guesses because we have no idea how your view or search indexes are actually configured.
cn flag
I did use /products for visibility - the TITLE shows, but no box to enter the search, and I tried it BOTH ways , like the pic shows, and with none of the product types checked and same effect nothing changed I will go back over it again, but I am begining to think it is the theme causing this. Either that or Domain Access / Theme code. For instance Bootsrap Barrio behaves differently than Adaptive Theme - and even in Adaptive Theme the two different projects "at_theme" (2.0) or "adaptivetheme" Drupal is now off the deep end - it worked on Drupal 8 - but not now on Drupal 9.3.8. Go Figure
sonfd avatar
in flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/134932/discussion-between-sonfd-and-wilburunion).
cn flag
The moderator who edited this changed the entire question. I am trying to get a search box that will search both content and commerce products as Ubercart did out of the box. The database search server can be indexed to do that. Now that I know the themes are partly to blame I will try a few things first changing themes . I am now on 9.3.9. A search is ridiculous if it doesn't search the entire site. A search of a product catalog box view shows but does not work to show results by solr so I will try the database server index there first. Ubercart just worked but Commerce is complication
Score:0
cn flag

Some themes may not display or properly display a block view in certain block regions. For instance AdaptiveTheme using the AT Tool theme generator would not display the Products search block in main content area of the theme and nor on the recommended /products page. It also does not display the add products or most any other "add" button in Drupal Commerce. Other themes do however. Drupal 7 had a module called "Domain Blocks" which associated theme block settings positively to a Domain when Domain Access was used but no such thing exists in Drupal 9 yet as it is only able to use the AT Tool to generate a theme by a different name and use those settings per domain. Placing the block view does display the Products Search block view if placed in the header or features region wich then opens the results in the main content region. It is hit and miss for varios themes - for instance "Danland" lists the second sidebar but does not display it. It probably has something to do with the new twig system of Drupal

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.