Files
season/sections/predictive-search.liquid
T
2026-10-09 23:02:05 -06:00

59 lines
2.0 KiB
Plaintext

{%- if predictive_search.performed -%}
{%- liquid
assign predictive_products = predictive_search.resources.products
-%}
<div class="header__predictive-body">
<p class="sr-only" data-predictive-count>
{%- if predictive_products.size > 0 -%}
{{ 'header.search_status' | t: count: predictive_products.size }}
{%- else -%}
{{ 'header.search_empty' | t: terms: predictive_search.terms }}
{%- endif -%}
</p>
{%- if predictive_products.size > 0 -%}
<ul class="header__predictive-list">
{%- for product in predictive_products -%}
<li>
<a
class="header__predictive-item"
id="PredictiveProduct-{{ product.id }}"
href="{{ product.url }}"
role="option"
>
<span class="header__predictive-media">
{%- if product.featured_image -%}
{{
product.featured_image
| image_url: width: 120
| image_tag:
alt: '',
widths: '60, 120',
sizes: '56px',
loading: 'lazy'
}}
{%- endif -%}
</span>
<span class="header__predictive-copy">
<span class="header__predictive-title">{{ product.title | escape }}</span>
<span class="header__predictive-price">{{ product.price | money_without_trailing_zeros }}</span>
</span>
</a>
</li>
{%- endfor -%}
</ul>
<a class="header__predictive-all" href="{{ routes.search_url }}?type=product&q={{ predictive_search.terms | url_encode }}">
{{ 'header.search_view_all' | t }}
</a>
{%- else -%}
<p class="header__predictive-empty">{{ 'header.search_empty' | t: terms: predictive_search.terms }}</p>
{%- endif -%}
</div>
{%- endif -%}
{% schema %}
{
"name": "t:header.predictive",
"settings": []
}
{% endschema %}