<commit_before><!-- /templates/search.liquid -->
{% comment %}

  The {{ content_for_header }} in theme.liquid will output the following stylesheet just for this page:
    - <link rel="stylesheet" href="/global/search.css" type="text/css">

  It has a few helpers in there, but this theme writes its own styles so there
  are no dependencies or conflicts. You can ignore that file.

  Return only products or pages in results:
    - http://docs.shopify.com/manual/configuration/store-customization/return-only-product-in-storefront-search-results
    - Or manually add type=product or type=page to the search URL as a parameter

{% endcomment %}

{% comment %}
  If you're only showing products with the method above, why not show them off in a grid instead?
  Set grid_results to true and see your updated results page for the new layout.
{% endcomment %}
{% assign grid_results = false %}

{% comment %}
  Check to enforce respond.js
{% endcomment %}
{% assign respond_js_secret_key = shop.domain | md5 %}
{% unless search.terms == respond_js_secret_key %}

  <div class="grid">
    <div class="grid__item large--two-thirds push--large--one-sixth">

      {% if search.performed %}

        {% comment %}
          Avoid accessing search.results before the opening paginate tag.
          If you do, the pagination of results will be broken.
        {% endcomment %}
        {% paginate search.results by 10 %}

          {% comment %}
            We don't have any results to show. Feel free to show off featured products
            or suggested searches here.
          {% endcomment %}
          {% if search.results_count == 0 %}

            <h1 class="h2 text-center">{{ 'general.search.no_results_html' | t: terms: search.terms }}</h1>
            {% include 'search-bar' %}

          {% else %}

            <h1 class="h2 text-center">{{ 'general.search.results_for_html' | t: terms: search.terms }}</h1>
            {% include 'search-bar' %}

            {% comment %}
              Each result template, based on the grid_layout variable above
            {% endcomment %}
            {% if grid_results == false %}

              {% for item in search.results %}
                {% comment %}
                  Check if the product is on sale and set a variable to be used below.
                {% endcomment %}
                {% assign on_sale = false %}
                {% if item.compare_at_price > item.price %}
                  {% assign on_sale = true %}
                {% endif %}

                {% comment %}
                  Check if the product is sold out and set a variable to be used below.
                {% endcomment %}
                {% assign sold_out = true %}
                {% if item.available %}
                  {% assign sold_out = false %}
                {% endif %}

                <div class="grid">

                  {% if item.featured_image %}
                    {% comment %}
                      We have a featured_image, so it's likely a product
                    {% endcomment %}
                    <div class="grid__item one-third">
                      <a href="{{ item.url }}" title="{{ item.title | escape }}">
                        {{ item.featured_image.src | img_url: 'medium' | img_tag: item.featured_image.alt }}
                      </a>
                    </div>
                  {% endif %}

                  {% comment %}
                    If we don't have a featured_image, add a push-- class to keep the alignment the same
                  {% endcomment %}
                  <div class="grid__item two-thirds {% unless item.featured_image %}push--one-third{% endunless %}">
                    <h3>{{ item.title | link_to: item.url }}</h3>

                    {% if item.price %}
                      <p>
                        {% comment %}
                          You can show a leading 'from' or 'up to' by checking 'product.price_varies'
                          if your variants have different prices.
                        {% endcomment %}
                        {% if on_sale %}
                          {% if item.price_varies %}
                            {% assign sale_price = item.price | money %}
                            {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
                          {% else %}
                            <strong>{{ 'products.product.on_sale' | t }}</strong>
                            <span itemprop="price">{{ item.price | money }}</span>
                          {% endif %}
                        {% else %}
                          {% if item.price_varies %}{{ 'products.general.from' | t }}{% endif %}
                          <span itemprop="price">{{ item.price | money }}</span>
                        {% endif %}
                        {% if sold_out %}
                          <br><strong>{{ 'products.product.sold_out' | t }}</strong>
                        {% endif %}
                        {% if on_sale %}
                          <br><s>{{ item.compare_at_price | money }}</s>
                        {% endif %}
                      </p>
                    {% endif %}

                    {% comment %}
                      Get a brief excerpt of raw text from the page/product
                    {% endcomment %}
                    <p>{{ item.content | strip_html | truncatewords: 50 }}</p>
                  </div>

                </div>

                {% unless forloop.last %}<hr>{% endunless %}
              {% endfor %}

            {% else %}

              <div class="grid-uniform">
                {% for item in search.results %}
                  {% assign grid_item_width = 'large--one-quarter medium--one-third small--one-half' %}

                  {% comment %}
                    Check if the product is on sale and set a variable to be used below.
                  {% endcomment %}
                  {% assign on_sale = false %}
                  {% if item.compare_at_price > item.price %}
                    {% assign on_sale = true %}
                  {% endif %}

                  {% comment %}
                    Check if the product is sold out and set a variable to be used below.
                  {% endcomment %}
                  {% assign sold_out = true %}
                  {% if item.available %}
                    {% assign sold_out = false %}
                  {% endif %}

                  <div class="grid__item search-result {{ grid_item_width }}">
                    {% if item.featured_image %}
                      <a href="{{ item.url | within: collection }}" title="{{ item.title | escape }}">
                        {{ item.featured_image.src | img_url: 'medium' | img_tag: item.featured_image.alt }}
                      </a>
                    {% endif %}

                      <h5>{{ item.title | link_to: item.url }}</h5>

                      {% if item.price %}
                        <p>
                          {% if on_sale %}
                            {% if item.price_varies %}
                              {% assign sale_price = item.price | money %}
                              {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
                            {% else %}
                              <strong>{{ 'products.product.on_sale' | t }}</strong>
                              <span itemprop="price">{{ item.price | money }}</span>
                            {% endif %}
                          {% else %}
                            {% if item.price_varies %}{{ 'products.general.from' | t }}{% endif %}
                            <span itemprop="price">{{ item.price | money }}</span>
                          {% endif %}
                          {% if sold_out %}
                            <br><strong>{{ 'products.product.sold_out' | t }}</strong>
                          {% endif %}
                          {% if on_sale %}
                            <br><s>{{ item.compare_at_price | money }}</s>
                          {% endif %}
                        </p>
                      {% endif %}
                  </div>

                {% endfor %}
              </div>

            {% endif %}

          {% endif %}

          {% if paginate.pages > 1 %}
            <div class="text-center">
              {% include 'pagination-custom' %}
            </div>
          {% endif %}

        {% endpaginate %}

      {% else %}

        {% comment %}<commit_msg>Cleaned up search result template<commit_after><!-- /templates/search.liquid -->
{% comment %}

  To return only products or pages in results:
    - http://docs.shopify.com/manual/configuration/store-customization/return-only-product-in-storefront-search-results
    - Or manually add type=product or type=page to the search URL as a parameter

{% endcomment %}

{% comment %}
  If you're only showing products with the method above, why not show them off in a grid instead?
  Set grid_results to true and see your updated results page for the new layout.
{% endcomment %}
{% assign grid_results = false %}

{% comment %}
  Check to enforce respond.js
{% endcomment %}
{% assign respond_js_secret_key = shop.domain | md5 %}
{% unless search.terms == respond_js_secret_key %}

  <div class="grid">
    <div class="grid__item large--two-thirds push--large--one-sixth">

      {% if search.performed %}

        {% comment %}
          Avoid accessing search.results before the opening paginate tag.
          If you do, the pagination of results will be broken.
        {% endcomment %}
        {% paginate search.results by 10 %}

          {% comment %}
            We don't have any results to show. Feel free to show off featured products
            or suggested searches here.
          {% endcomment %}
          {% if search.results_count == 0 %}

            <h1 class="h2 text-center">{{ 'general.search.no_results_html' | t: terms: search.terms }}</h1>
            {% include 'search-bar' %}

          {% else %}

            <h1 class="h2 text-center">{{ 'general.search.results_for_html' | t: terms: search.terms }}</h1>
            {% include 'search-bar' %}

            <hr>

            <div class="grid-uniform">
              {% for item in search.results  %}
                {% comment %}
                  Check if the product is on sale and set a variable to be used below.
                {% endcomment %}
                {% assign on_sale = false %}
                {% if item.compare_at_price > item.price %}
                  {% assign on_sale = true %}
                {% endif %}

                {% comment %}
                  Check if the product is sold out and set a variable to be used below.
                {% endcomment %}
                {% assign sold_out = true %}
                {% if item.available %}
                  {% assign sold_out = false %}
                {% endif %}

                {% if grid_results == false %}
                  <!-- begin list search results-->
                  <div class="grid__item">
                    <div class="grid">
                      {% if item.featured_image %}
                        {% comment %}
                          We have a featured_image, so it's likely a product
                        {% endcomment %}
                        <div class="grid__item one-third">
                          <a href="{{ item.url }}" title="{{ item.title | escape }}">
                            {{ item.featured_image.src | img_url: 'medium' | img_tag: item.featured_image.alt }}
                          </a>
                        </div>
                      {% endif %}

                      {% comment %}
                        If we don't have a featured_image, add a push-- class to keep the alignment the same
                      {% endcomment %}
                      <div class="grid__item two-thirds {% unless item.featured_image %}push--one-third{% endunless %}">
                        <h3>{{ item.title | link_to: item.url }}</h3>

                        {% if item.price %}
                          <p>
                            {% comment %}
                              You can show a leading 'from' or 'up to' by checking 'product.price_varies'
                              if your variants have different prices.
                            {% endcomment %}
                            {% if on_sale %}
                              {% if item.price_varies %}
                                {% assign sale_price = item.price | money %}
                                {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
                              {% else %}
                                <strong>{{ 'products.product.on_sale' | t }}</strong>
                                <span itemprop="price">{{ item.price | money }}</span>
                              {% endif %}
                            {% else %}
                              {% if item.price_varies %}{{ 'products.general.from' | t }}{% endif %}
                              <span itemprop="price">{{ item.price | money }}</span>
                            {% endif %}
                            {% if sold_out %}
                              <br><strong>{{ 'products.product.sold_out' | t }}</strong>
                            {% endif %}
                            {% if on_sale %}
                              <br><s>{{ item.compare_at_price | money }}</s>
                            {% endif %}
                          </p>
                        {% endif %}

                        {% comment %}
                          Get a brief excerpt of raw text from the page/product
                        {% endcomment %}
                        <p>{{ item.content | strip_html | truncatewords: 50 }}</p>
                      </div>
                    </div>
                  </div>
                  {% unless forloop.last %}<hr>{% endunless %}
                  <!-- //list search results-->
                {% else %}
                  <!-- begin grid search results-->
                  <div class="grid__item search-result large--one-quarter medium--one-third small--one-half">
                    {% if item.featured_image %}
                      <a href="{{ item.url | within: collection }}" title="{{ item.title | escape }}">
                        {{ item.featured_image.src | img_url: 'medium' | img_tag: item.featured_image.alt }}
                      </a>
                    {% endif %}

                    <h5>{{ item.title | link_to: item.url }}</h5>

                    {% if item.price %}
                      <p>
                        {% if on_sale %}
                          {% if item.price_varies %}
                            {% assign sale_price = item.price | money %}
                            {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
                          {% else %}
                            <strong>{{ 'products.product.on_sale' | t }}</strong>
                            <span itemprop="price">{{ item.price | money }}</span>
                          {% endif %}
                        {% else %}
                          {% if item.price_varies %}{{ 'products.general.from' | t }}{% endif %}
                          <span itemprop="price">{{ item.price | money }}</span>
                        {% endif %}
                        {% if sold_out %}
                          <br><strong>{{ 'products.product.sold_out' | t }}</strong>
                        {% endif %}
                        {% if on_sale %}
                          <br><s>{{ item.compare_at_price | money }}</s>
                        {% endif %}
                      </p>
                    {% endif %}
                  </div>
                  <!-- //grid search results-->
                {% endif %}

              {% endfor %}
            </div>

          {% endif %}

          {% if paginate.pages > 1 %}
            <div class="text-center">
              {% include 'pagination-custom' %}
            </div>
          {% endif %}

        {% endpaginate %}

      {% else %}

        {% comment %}
{'fraction_non_alphanumeric': 0.12088998763906057, 'fraction_numerical': 0.0021013597033374535, 'mean_word_length': 1.144599072233267, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 132, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5595511', 'n_tokens_mistral': 4442, 'n_tokens_neox': 3732, 'n_words': 1084}