0
<select name="store:price">
    <option value="0">PRICE</option>
    <option value="|10"{if low_search_store:price == "|10"} selected{/if}>up to $10</option>
    <option value="10|25"{if low_search_store:price == "10|25"} selected{/if}>$10 to $25</option>
    <option value="25|50"{if low_search_store:price == "25|50"} selected{/if}>$25 to $50</option>
    <option value="50|100"{if low_search_store:price == "50|100"} selected{/if}>$50 to $100</option>
    <option value="100|"{if low_search_store:price == "100|"} selected{/if}>$100 and up</option>
</select>

This works great, when the search form is submitted, it returns the results with the price select selected based on the query in segement 3.

I also want to be able to search based on color, that value is stored in the products channel custom field: cf_product_color and not as a store modifier.

<select name="search:cf_product_color">
    <option value="">COLOR</option>
    <option value="red" {if search:cf_product_color=="red"} selected{/if}>Red</option>
    <option value="orange" {if search:cf_product_color=="orange"} selected{/if}>Orange</option>
</select>

This does not work, when I select a color (I know the color exists in that custom field: cf_product_color for entries) and it does not select the color from the select color drop down after submitting like it does for the price select drop-down.

This leads me to think I need to create a collection since I have a price, color select dropdowns making it 2 pieces of data I am searching for. Is this the case?

2

You only need to create collections if you're using the Keywords filter.

The variables created based on the parameters need to be prefixed with low_search_, as per how params work in LS. So try this as a conditional instead:

{if low_search_search:cf_product_color == "red"}
| improve this answer | |
  • what should the name of the select field be? select name="cf_product_color" ? – Brad Oct 27 '15 at 17:35
  • 1
    No, name="search:field_name", see gotolow.com/addons/low-search/docs/filters#field-search – Low Oct 27 '15 at 18:09
  • Got that part working now I notice it won't return any results unless I have both a value selected in the price and color drop-downs. If I leave the price blank/unselected and select a color, it returns nothing, if I select the price along with a color, it returns results. If I leave the color dropdown unselected/blank and select a price, it returns results. I need the ability to select one or both. – Brad Oct 27 '15 at 18:25
  • 1
    Your first Price option should have an empty value rather than 0: <option value="">PRICE</option> -- 0 is a valid value, too. – Low Oct 27 '15 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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