All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Search for related custom field

NIall O'Brien 24 Oct 2014 10:29 question, complete

Hi, I'm trying to search through a products channel for all products of a specific category with related brand ie. /category/sub-category/brand
How can I utilise low_search to achieve this? I can't use hashed keywords, and ?keyword=brand isn't ideal in this scenario.
Ideally something like

{exp:low_search:results channel="products" dynamic="no" category="{segment_category_ids}" query={segment_3} status="open|readonly" limit='15' paginate="bottom"}

Please advise.

Replies

  1. Low 24 Oct 2014 10:56

    If you're not using encoded queries, then having query="{segment_3}" is not necessary.

    If segment 3 (brand) is an entry url title, you'd need to convert that to an entry ID before you can use the Relationships filter in Low Search, as that only takes IDs (just like the category param).

    Then you're looking at something like

    {exp:low_search:results channel="products" category="{segment_category_ids}" child:product_brand="X" ... }

    ...where product_brand is the relationship field and X is the ID for segment 3.

  2. NIall O'Brien 24 Oct 2014 11:15

    Hi, segment_3 isn't an entry url, segment_3 is the keyword I wish to perform a search with.

  3. Low 24 Oct 2014 11:19

    In that case, this would work:

    {exp:low_search:results channel="products" category="{segment_category_ids}" keywords="{segment_3}" ... } 

    But there's no good way of generating a URL like that with LS, which is why it uses either the encoded query or regular query strings. If you want to build custom URIs, that's fine. But you'd have to map them to parameters in the Results tag yourself.

  4. NIall O'Brien 24 Oct 2014 11:43

    no_results always returns true in this case - which is incorrect.

  5. Low 24 Oct 2014 11:44

    I'll need to take a look myself. Please send SuperAdmin login credentials to hi at gotolow dot com if you can.

  6. NIall O'Brien 24 Oct 2014 11:56

    Email sent. Please verify before I send login details. Thanks.