1

I am building a property rental site using EE 2.10.1 and Low Search 4.3.1. I am trying to sort the results of the Low Search query by limit, bedrooms and occupancy. I have this working perfectly on a general search results page, as shown in this URL:

http://movingmo.nextmp.net/search/homes/eyJyZXN1bHRfcGFnZSI6Ilwvc2VhcmNoXC9ob21lcyIsInNlYXJjaDphbWVuaXRpZXM6YW1lbml0aWVzX25hbWUiOiJGaXJlcGxhY2UiLCJsaW1pdCI6IjUwMCJ9

But when trying to apply the same sorting to a page that displays a Low Search Shortcut it doesn't work. I've tried changing the query parameter and adding in the shortcut parameter to the tags but can't seem to figure this out. Here's some template code, shortened for brevity but I think it will show where I'm at.

This is the tag on the general search results:

{exp:low_search:results
 query="{segment_3}"
 site="foo"
 collection="bar"
}
 <label class="left inline" for="orderby_sort">Sort by:</label>
 <select name="orderby_sort" class="sort" id="orderby_sort" onchange="location = this.options[this.selectedIndex].value;">
  <option value="">---</option>
  <option value="{exp:low_search:url query="{segment_3}" orderby_sort="bedroomCount|asc"}">Bedrooms - Low to High</option>
  <option value="{exp:low_search:url query="{segment_3}" orderby_sort="bedroomCount|desc"}">Bedrooms - High to Low</option>
  <option value="{exp:low_search:url query="{segment_3}" orderby_sort="maxGuestCount|asc"}">Sleeps - Low to High</option>
  <option value="{exp:low_search:url query="{segment_3}" orderby_sort="maxGuestCount|desc"}">Sleeps - High to Low</option>
 </select>
 <label class="left inline" for="limit">Homes per page:</label>
 <select name="limit" class="limit" id="limit" onchange="location = this.options[this.selectedIndex].value;">
  <option value="">---</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="12"}">12</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="24"}">24</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="36"}">36</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="48"}">48</option>
  <option value="{exp:low_search:url query="{segment_3}" limit="500"}">All</option>
 </select>
 ...search results here...
{/exp:low_search:results}

And this is the tag on a page that uses a Shortcut, for example: http://movingmo.nextmp.net/luxury-rental-homes/condos-residences

{exp:low_search:results
  shortcut="condos-residences"
  site="foo"
  collection="bar"
}
 <label class="left inline" for="orderby_sort">Sort by:</label>
 <select name="orderby_sort" class="sort" id="orderby_sort" onchange="location = this.options[this.selectedIndex].value;">
  <option value="">---</option>
  <option value="{exp:low_search:url shortcut="condos-residences" orderby_sort="bedroomCount|asc"}">Bedrooms - Low to High</option>
  <option value="{exp:low_search:url shortcut="condos-residences" orderby_sort="bedroomCount|desc"}">Bedrooms - High to Low</option>
  <option value="{exp:low_search:url shortcut="condos-residences" orderby_sort="maxGuestCount|asc"}">Sleeps - Low to High</option>
  <option value="{exp:low_search:url shortcut="condos-residences" orderby_sort="maxGuestCount|desc"}">Sleeps - High to Low</option>
 </select>
 <label class="left inline" for="limit">Homes per page:</label>
 <select name="limit" class="limit" id="limit" onchange="location = this.options[this.selectedIndex].value;">
  <option value="">---</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="12"}">12</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="24"}">24</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="36"}">36</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="48"}">48</option>
  <option value="{exp:low_search:url shortcut="condos-residences" limit="500"}">All</option>
 </select>
...search results from shortcut here...
{/exp:low_search:results}

I thought changing the query parameter to a shortcut parameter would work but no luck. I also tried adding a result_page parameter but that didn't work either.

Am I missing a parameter on my tag somewhere? Is it not possible to sort this way with a Shortcut?

1 Answer 1

1

When you amend a shortcut by overwriting or adding other parameters, you end up with a new query. You then have to pass that query on to the Results tag.

So, try adding query="{segment_3}" to the second Results tag. If segment_3 can both contain a shortcut name and an encoded query, you can use query="{segment_3}" shortcut="{segment_3}" and the shortcut will be displayed if it is valid, otherwise the encoded query will be displayed.

1
  • Thanks for the info Low. I added the query parameter to the results tag but also had to add it to the exp:low_search:url tag. Once I did that it worked as expected.
    – Eric
    Oct 24, 2015 at 14:14

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.