List results from one category (autocomplete)

Hi there!
Is there any way to achieve:

  • User is on Category page
  • User is typing into search field
  • Autocomplete function list only results from the current category.

Thanks!

Unfortunately, we don’t support indexing a product’s collections.
You can see a summary about this issue here: Usage on collection pages .

However, if you were to classify your products using a tag or a metafield, what you want would be achievable. :slight_smile:

Hey @Jerska Is that not possible at Shopify or Zendesk too?

If it’s not possible at ZD, is possible to add class category id to elements from the screen?
Please see here https://cl.ly/mT53

in that case, I will be able to filter out auto-complete results by category with the help of CSS.

EDIT:

I think I got it, have changed this part of the code:

article: (0, s.default)('<div\n  class="\n    aa-article-hit  catogory-[[ category.id ]]\n    [[#

Oops. I indeed mixed up the topics on this one, sorry about that!

You can definitely do that with our Zendesk integration.
Sections and Categories are already filters, so you can reuse them in the front-end.
You can actually use optionalFilters here to put the ones in this category first, but have the other ones still displayed after / if no results are found in this category.

I’d also suggest you to do the same thing when on a section page.
You can use only one on the Free and Essential plans, so you’ll need to choose between using an optional filter on the category or the section directly (with a low average amount of articles per section, I’d suggest sticking with category).

For this however, you’ll need to modify the code.
You can find it here, in the app/ folder.
It seems like this would be a great addition to the app to be baked in by default, and while I don’t have much time to work on this right now, I’d be really happy if you were to make a Pull Request to the project!