No filter display if category not selected

Hi there,
My listing has multiple categories and when a user get on the home page they can click on search without selecting any category. When they do so, in the search results I see a filter button but no category to filter by. I checked your live demo page and it seems to be working fine there but you are not using categories on the search bar, so not sure if that’s the issue.

See my app screenshot:

See screenshot from your demo

Hi,

Please disable third-party plugins and customizations (if there are any) and check if this issue persists. If you use a caching plugin, make sure that caching is disabled for logged-in users. If this issue exists, please provide more details regarding this issue (e.g., your actions step by step with screenshots, etc.). This will help us to reproduce and resolve the issue faster.

Hello,
I disabled all third party plugins and customizations but I see the same thing. I believe that this issue happens when categories is selected in in the default search, see screenshot #1.
Steps to reproduce

  1. Add categories in the “default fields” of your hivepress listing configuration (see screenshot #1)
  2. Go to your hivepress homepage and click the search button without entering any keyword or location or category
  3. Search results are displayed with a “filter” button but no option to filter by (see screenshot #2)
  4. Expected behavior: Search results should be displayed with “All categories” in the filter option.

Thanks!

Hi,

Please check if your attributes are not assigned to a category, if so, you need to select one of the categories, then you will see certain attributes in the search filter.

Hi there, all my attributes are assigned to at least one category. if I select any search criteria everything works as expected and I see them in the search filter. This issue only appears if I don’t enter any search criteria in any of the search boxes in the home page (you have to use keyword in your default filter). Did you try the steps to reproduce that I added in my previous message? it should be easy to reproduce. I suspect that this is a bug in the current version.

Hi,

Yes, we tried to repeat the problem step by step, as you described, but everything is working correctly on our end and the filters are displayed. If you have the opportunity, please record a screencast, for example, using awesomescreenshot.com

I emailed the screencast to support@hivepress.io, please let me know once you get it.

Thanks so much!

Hi,

Please send temporary WP access to support@hivepress.io with details for reproducing this issue, and we’ll check it (please send only the link, without login and password). You can create a temporary access link using this plugin Temporary Login Without Password – WordPress plugin | WordPress.org.

I emailed you the Temporary login with the steps to reproduce the issue.

Thanks!

Hi,

We checked this issue from our side, and it seems okay. The reason is that all of your attributes are linked to categories, so when you select All Categories, you will not see anything in the filters. If you want attributes to appear in all categories, then you need to not restrict attributes to any category.

1 Like

Thanks for looking into this! But I am not sure I understand your solution, it doesn’t seem to work. I created a Test Attribute and did no add it to any category and this is what it looks like:
Screen Shot 2024-02-02 at 8.06.14 AM

Again here is what I expected it to look like: when I do a search without selecting any category it should show me all the categories available like in your demo.

I hope you can look more into this to help me figure it out. Also I can give you access to my staging environment where you can make changes to verify your thesis if that helps.

Hi there, I have confirmed that this is a bug in hivepress. I reinstalled hivepress on my staging environment and imported the demo content and see the same behavior.
Here are the steps to reproduce with screenshot attached.
1- Add keyword to the default search


2- Go to the homepage and just click search with no value in keyword or category

3- See the search results, there is no categories displayed when All categories should be displayed

I have emailed you another temporary login to the demo site so you can test this yourself.
Thanks

Hi,

Unfortunately, the category search does not work as you described. Let’s say you have 3 categories and you have created 3 attributes and assigned one attribute to each category. If you go to your website and select All Categories in the search, you will not see any filter. If, for example, you select one category, you will see the filter of the attribute that is linked to this category. If you do not assign any attributes to any category and select All Categories in the search, all attributes in the filter will be displayed.

I understand what you are saying but this seems a bit inconsistent with the way keyword search (and other search tools) works. If I don’t enable categories and only enable keywords in the default search, I see all categories (see attached picture). If you call it “All categories”, should it not be showing All categories like the name indicated? It seems like the implementation is “No category assigned” instead “All Categories” if that makes sense. Also if there is nothing to filter by, we should probably hide the filter button? right now it is a button that does nothing, so it a bit confusing for the customer. Do you think this is something that can be fixed or maybe there is a workaround?

Hi,

Unfortunately, it doesn’t work this way, the All Categories option will only work if all attributes are not assigned to any of the categories. You can change the name of All Categories in Loco Translate if necessary How to change any static text - HivePress Help Center. Also, if you need to, you can overwrite the template parts and not add the filter, then it will be unavailable How to customize templates - HivePress Help Center.

Thanks for looking into this, Andrii. I get it.

Is there any way I can achieve this? My main workflow is based on a user being able to search all categories if they don’t enter a keyword. I see it already works like this when I only enable keyword in the hivepress setting.
I was wondering if there is anyway to intercept the search request and if the user has not selected a category, execute the search the same way it is executed when categories are not enabled?
I understand you don’t support customization, however I can do it myself if you point me in the right direction.

Thanks again!

Hi,

Unfortunately, there is no simple solution here, it will require a detailed review of the code and custom implementation.

Ok. Thanks. One last question. I would like to hide the filter button if there is nothing to filter by. The video you linked shows me how to remove the “filter” button entirely, but I only want to hide if there is nothing to filter by (since the button has not use). Can you share more about how to do that? Thanks!

Hi,

Yes, this is possible, but it will require a custom implementation using a PHP snippet.

Hello Andrii, Is there any chance you can help with the snippet or guide me through implementing it? Currently hivepress shows a “filter” button when there is nothing to filter and If users click “filter” nothing happen. I think the code snippet will be valuable for other users as well.

Thanks again!

1 Like