Search - CrystalCommerce Liquid Documentation for Designers

Search

The search page shows the user their search results for a given query.

Additional Variables Available

query
The query the user searched for. HTML escaped to prevent XSS.
next_page
Integer page number that follows the current one. Example: 3
previous_page
Integer page number that precedes the current one. Example: 1
max
The highest page count for the given search Example: 4
current_page
Current page number in the search results. Example: 2
bad_searches
List of product names that weren’t found (multisearch results only) Example: [‘Adarkar Wastes’, ‘Shivan Dragon’]

Used in Routes

  • /products/search
  • /buylist/search

File: search.liquid

Default Liquid Template

<h1 class="pagetitle">Search results for "{{query}}"</h1>

<div class="pagination">{{ products | paginate }}</div>

<div class="products">
  {% if products.size > 0 %}
    <table border="0" class="invisible-table" width="100%">
      {% include 'product' with products %}
    </table>

    <div class="pagination">{{ products | paginate }}</div>
  {% else %}
    Your search returned no results.
  {% endif %}
</div>

Default Mobile Liquid Template

<header>
  <h1>Search results for "{{query}}"</h1>
  {% include 'header_icons' %}
</header>
{% include 'quick_search' %}

<div class="pagination">{{ products | paginate }}</div>

<div class="products">
  {% if products.size > 0 %}
  <ul class="products">
    {% include 'product' with products %}
  </ul>
  <div class="pagination">{{ products | paginate }}</div>

  {% else %}
    <p class="no-products-message">Your search returned no results.</p>
  {% endif %}
</div>

Drops Supported