<commit_before><!-- /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 %}
  Set grid_results to true and set search results as a grid instead of a list.
  This works well when your search is only for products.
{% 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 %}

{% 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 %}

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

      {% if search.performed %}
        {% if search.results_count == 0 %}
          <h1 class="h2 text-center results-title">{{ 'general.search.no_results_html' | t: terms: search.terms }}</h1>
        {% else %}
          <h1 class="h2 text-center results-title">{{ 'general.search.results_for_html' | t: terms: search.terms }}</h1>
        {% endif %}
      {% else %}
        <h1 class="h2 text-center results-title">{{ 'general.search.title' | t }}</h1>
      {% endif %}

      {% include 'search-bar' %}

      {% if search.performed %}

        <hr class="hr--clear">

        <div class="grid-uniform">
          {% for item in search.results %}

            {% comment %}
              ### NOTE KLT062716: Beeketing Boost Sales Product Price Snippet and Variable Replacements
              - http://bit.ly/1TB8dYB
              - https://youtu.be/nxc_-VXavt8?t=10m35s
              - Variables replacement:
                - item.price = scn_product_min
                - item.price_min = scn_product_min
                - item.price_varies = scn_price_varies
                - {{ item | json }} = scnProduct({{ item | json }})
                - item.selected_or_first_available_variant = scn_first_product_variant
            {% endcomment %}
            {% include 'scn-product-price' with item %}

            {% 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 > scn_product_min %}
              {% 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">
                  {% comment %}
                    ### NOTE KLT072516: Modified to include other image types as "featured" image
                  {% endcomment %}
                  {% assign result_image = null %}
                  {% if item.featured_image %}
                    {% assign result_image = item.featured_image %}
                  {% elsif item.image %}
                    {% assign result_image = item.image %}
                  {% endif %}
                  {% if result_image %}
                    {% comment %}
                      We have a featured_image, so it's likely a product
                    {% endcomment %}
                    <div class="grid__item one-quarter">
                      <a href="{{ item.url }}" title="{{ item.title | escape }}" class="result-image">
                        {{ result_image.src | img_url: 'medium' | img_tag: result_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 three-quarters {% unless result_image %}push--one-quarter{% endunless %}">
                    <h3 class="result-title">{{ item.title | link_to: item.url }}</h3>

                    {% if scn_product_min %}
                      <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 scn_price_varies %}
                            {% assign sale_price = scn_product_min | money %}
                            {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
                          {% else %}
                            <strong>{{ 'products.product.on_sale' | t }}</strong>
                            <span itemprop="price">{{ scn_product_min | money }}</span>
                          {% endif %}
                        {% else %}


                          {% comment %}
                            ### NOTE KLT070816: Integrated unit price and label with search results
                          {% endcomment %}
                          {% assign product_object = item %}

                          {% comment %}
                            {% if scn_price_varies %}
                              {% assign price = scn_product_min | money %}
                              <span itemprop="price">{{ 'products.general.from_text_html' | t: price: price }}</span>
                            {% else %}
                              <span itemprop="price">{{ scn_product_min | money }}</span>
                            {% endif %}
                          {% endcomment %}
                          {% if item.metafields.priceUnit.pricePerPound %}
                            {% assign unit_price = item.metafields.priceUnit.pricePerPound | times: 100 | money %}
                          {% else %}
                            {% assign unit_price = scn_product_min | money %}
                          {% endif %}

                          <span itemprop="price">
                            {% include 'product-unit-price-label' with product_object, unit_price %}
                          </span>

                        {% endif %}
                        {% if sold_out %}
                          <br><strong>{{ 'products.product.sold_out' | t }}</strong>
                        {% endif %}
                        {% if on_sale %}
                          <br><span class="visually-hidden">{{ 'products.general.sale_price' | t }}</span><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 %}<commit_msg>Search result sold out product messaging<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 %}
  Set grid_results to true and set search results as a grid instead of a list.
  This works well when your search is only for products.
{% 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 %}

{% 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 %}

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

      {% if search.performed %}
        {% if search.results_count == 0 %}
          <h1 class="h2 text-center results-title">{{ 'general.search.no_results_html' | t: terms: search.terms }}</h1>
        {% else %}
          <h1 class="h2 text-center results-title">{{ 'general.search.results_for_html' | t: terms: search.terms }}</h1>
        {% endif %}
      {% else %}
        <h1 class="h2 text-center results-title">{{ 'general.search.title' | t }}</h1>
      {% endif %}

      {% include 'search-bar' %}

      {% if search.performed %}

        <hr class="hr--clear">

        <div class="grid-uniform">
          {% for item in search.results %}

            {% comment %}
              ### NOTE KLT062716: Beeketing Boost Sales Product Price Snippet and Variable Replacements
              - http://bit.ly/1TB8dYB
              - https://youtu.be/nxc_-VXavt8?t=10m35s
              - Variables replacement:
                - item.price = scn_product_min
                - item.price_min = scn_product_min
                - item.price_varies = scn_price_varies
                - {{ item | json }} = scnProduct({{ item | json }})
                - item.selected_or_first_available_variant = scn_first_product_variant
            {% endcomment %}
            {% include 'scn-product-price' with item %}

            {% 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 > scn_product_min %}
              {% 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">
                  {% comment %}
                    ### NOTE KLT072516: Modified to include other image types as "featured" image
                  {% endcomment %}
                  {% assign result_image = null %}
                  {% if item.featured_image %}
                    {% assign result_image = item.featured_image %}
                  {% elsif item.image %}
                    {% assign result_image = item.image %}
                  {% endif %}
                  {% if result_image %}
                    {% comment %}
                      We have a featured_image, so it's likely a product
                    {% endcomment %}
                    <div class="grid__item one-quarter">
                      <a href="{{ item.url }}" title="{{ item.title | escape }}" class="result-image">
                        {{ result_image.src | img_url: 'medium' | img_tag: result_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 three-quarters {% unless result_image %}push--one-quarter{% endunless %}">
                    <h3 class="result-title">{{ item.title | link_to: item.url }}</h3>

                    {% if scn_product_min %}
                      <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 scn_price_varies %}
                            {% assign sale_price = scn_product_min | money %}
                            {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
                          {% else %}
                            <strong>{{ 'products.product.on_sale' | t }}</strong>
                            <span itemprop="price">{{ scn_product_min | money }}</span>
                          {% endif %}
                        {% else %}


                          {% comment %}
                            ### NOTE KLT070816: Integrated unit price and label with search results
                          {% endcomment %}
                          {% assign product_object = item %}

                          {% comment %}
                            {% if scn_price_varies %}
                              {% assign price = scn_product_min | money %}
                              <span itemprop="price">{{ 'products.general.from_text_html' | t: price: price }}</span>
                            {% else %}
                              <span itemprop="price">{{ scn_product_min | money }}</span>
                            {% endif %}
                          {% endcomment %}
                          {% if item.metafields.priceUnit.pricePerPound %}
                            {% assign unit_price = item.metafields.priceUnit.pricePerPound | times: 100 | money %}
                          {% else %}
                            {% assign unit_price = scn_product_min | money %}
                          {% endif %}

                          {% if sold_out == false %}
                          <span itemprop="price">
                            {% include 'product-unit-price-label' with product_object, unit_price %}
                          </span>
                          {% endif %}

                        {% endif %}
                        {% if sold_out %}
                          <!--<br>--><strong>{{ 'products.product.sold_out' | t }}</strong>
                        {% endif %}
                        {% if on_sale %}
                          <br><span class="visually-hidden">{{ 'products.general.sale_price' | t }}</span><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 %}
{'fraction_non_alphanumeric': 0.116544636259824, 'fraction_numerical': 0.006045543091287701, 'mean_word_length': 1.3135975135975135, 'pattern_counts': {'":': 0, '<': 96, '<?xml version=': 0, '>': 98, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1272673', 'n_tokens_mistral': 4186, 'n_tokens_neox': 3571, 'n_words': 975}