0

This is a follow-up question related to another thread, Combine multiple categories into one select option.

I have a Low Search form that works like a quiz, narrowing down entries within a channel through the category filter. I'm seeing an issue whereby the search results page defaults to the same result no matter which options I choose.

I've confirmed that the proper categories are applied to the channel entries. It doesn't "remember" the categories searched on and just displays the same result over and over.

At first I thought this might be a caching issue but if you visit the page linked below and then click the submit button without selecting any options you'll see results return for the "1 Bedroom" category.

Question: Why are the category filters not being applied to the search query?

I am on EE 2.8.1, Low Search 3.5.2 and am also using Stash, Switchee, Structure and Freebie. The query parameter is set to {freebie_3} for the form tag and the results tag. I'm guessing there is some caching issue with the template but since it's working locally I'm at a loss as to what could be different across the environments.

Here's the link to see the form in action:

http://staging.l45living.com/floor-plans

Here's the form code for reference (with some code removed):

{exp:low_search:form
  form_id="submit-quiz"
  query="{freebie_3}"
  result_page="/floor-plans/search"
}

      <div class="row">
        <div class="small-12 medium-5 columns">
          <label class="inline" for="bedrooms">Number of bedrooms?</label>
        </div>
        <div class="small-12 medium-7 columns">
          <select name="category[]">
            <option value="">Show me all the options!</option>
            {exp:channel:categories
              category_group="1"
              show="not 4"
              style="linear"
            }
              <option value="{category_id}"{if low_search_category ~ '/\b'.category_id.'\b/'} selected{/if}>
                {category_name}
              </option>
            {/exp:channel:categories}
          </select>
        </div>
      </div>

      <div class="row">
        <div class="small-12 medium-5 columns">
          <label class="inline" for="floor">What floor do you like?</label>
        </div>
        <div class="small-12 medium-7 columns">
          <select name="category[]">
            <option value="">Show me all the options!</option>
            {exp:channel:categories
              category_group="2"
              show="28|29|30"
              style="linear"
            }
              <option value="{category_id}"{if low_search_category ~ '/\b'.category_id.'\b/'} selected{/if}>
                {category_name}
              </option>
            {/exp:channel:categories}
          </select>
        </div>
      </div>

      <div class="row">
        <div class="small-12 medium-5 columns">
          <label class="inline" for="view">What would you like your view to include?</label>
        </div>
        <div class="small-12 medium-7 columns">
          <select name="category[]">
            <option value="">Show me all the options!</option>
            {exp:channel:categories
              category_group="3"
              style="linear"
            }
              <option value="{category_id}"{if low_search_category ~ '/\b'.category_id.'\b/'} selected{/if}>
                {category_name}
              </option>
            {/exp:channel:categories}
          </select>
        </div>
      </div>

      <div class="row">
        <div class="small-12 medium-5 columns">
          <label class="inline" for="pets">Are you bringing a pet?</label>
        </div>
        <div class="small-12 medium-7 columns">
          <select name="category[]">
            {exp:channel:categories
              category_group="5"
              style="linear"
            }
              <option value="{category_id}"{if low_search_category ~ '/\b'.category_id.'\b/'} selected{/if}>
                {category_name}
              </option>
            {/exp:channel:categories}
          </select>
        </div>
      </div>

      <div class="row">
        <div class="small-12 medium-5 columns">
          <label class="inline" for="lifestyle">What's your lifestyle?</label>
        </div>
        <div class="small-12 medium-7 columns">
          <select name="category[]">
            <option value="">No preference. I go with the flow</option>
            {exp:channel:categories
              category_group="4"
              style="linear"
            }
              <option value="{category_id}"{if low_search_category ~ '/\b'.category_id.'\b/'} selected{/if}>
                {category_name}
              </option>
            {/exp:channel:categories}
          </select>
        </div>
      </div>

      <div class="row">
        <div class="small-8 small-centered columns">
          <button id="btn-submit-quiz" type="submit" class="submit">Find my perfect apartment</button>
        </div>
      </div>
    {/exp:low_search:form}

Here's the results code for reference (with some markup removed):

{exp:low_search:results
  channel="units"
  orderby="title"
  query="{freebie_3}"
  require_all="category"
  sort="asc"
}
  ....    
{/exp:low_search:results}
2
  • It's looking like the Results tag nor the Form tag are reading the query correctly. Turn on template debugging and look up all the lines that mention Low Search or low_search. What does that tell you?
    – Low
    Feb 23, 2015 at 22:05
  • @Low thanks for the feedback. I had a lot going on in the template with Stash and Switchee variables so I tried it on a clean, simplified template and it appears to be correctly reading the query. I'll monitor it and open a new thread if needed.
    – Eric
    Feb 27, 2015 at 19:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.