Search within Category - CrystalCommerce Liquid Documentation for Designers

Search within Category

Added ability to filter the site search by a first-level category. Use search_category_dropdown and search_query_box.

Example:

<div id="site_search">
  <form id="searchform" method="get" action="{{ site.search_path }}">
    {{ '1' | search_category_dropdown }}
    {{ 'Search for..' | search_query_box }}
    <input value="go" id="searchsubmit" type="submit" />
  </form>
</div>

And add the category selected to the `_search_pagination.liquid` partial.

{% if max > 1 %}
  {% if previous_page %}
    <a href="{{ site.search_path }}?q={{query}}&c={{category_selected}}&page={{previous_page}}">Previous</a> |
  {% endif %}
  Page {{ current_page }} of {{ max }}
  {% if next_page %}
    | <a href="{{ site.search_path }}?q={{query}}&c={{category_selected}}&page={{next_page}}">Next</a>
  {% endif %}
{% endif %}