{# Shared fragments. The product card reproduces the source .ProductThumbnail_container contract recorded in scope/notes/02-recon-plp.md. #} {% macro stars(rating) %} ★★★★★ ★★★★★ {% endmacro %} {% macro price_block(product) %}
{% if product.price_low != product.price_high %} Price range from: ${{ '%.2f'|format(product.price_low) }} to: ${{ '%.2f'|format(product.price_high) }} ${{ '%.2f'|format(product.price_low) }}-${{ '%.2f'|format(product.price_high) }} {% else %} Price: ${{ '%.2f'|format(product.price_low) }} ${{ '%.2f'|format(product.price_low) }} {% endif %}
{% endmacro %} {% macro product_card(product) %}
  • {% if product.colors %}
    Colors
    {% endif %} {{ product.name }} {{ price_block(product) }} {% if product.color_count %}
    {{ product.color_count }} colors available
    {% endif %} {{ stars(product.rating) }} {{ product.review_count }}
  • {% endmacro %} {% macro product_grid(items) %} {% endmacro %} {# The panel renders only the facets the source shows for this collection, in the source's order. Every facet here filters against real local data, so no control is inert. #} {% macro checkbox_group(title, name, options, selected) %} {% if options %}

    {{ title }}

    {% for opt in options %} {% endfor %}
    {% endif %} {% endmacro %} {% macro facet_panel(facets, selected, sort_options, action, hidden) %}
    {% for key, value in (hidden or {}).items() %}{% endfor %}

    Filter By:

    Sort

    {% for key in facets.order %} {% if key == 'percent_off' %} {{ checkbox_group('% Off', 'percent_off', facets.percent_off, selected.percent_off) }} {% elif key == 'sale' and facets.sale %}

    Sale

    {% elif key == 'new' and facets.new %}

    New Arrivals

    {% elif key == 'gender' %} {{ checkbox_group('Gender', 'gender', facets.gender, selected.gender) }} {% elif key == 'size' %} {{ checkbox_group('Size', 'size', facets.size, selected.size) }} {% elif key == 'material' %} {{ checkbox_group('Material', 'material', facets.material, selected.material) }} {% elif key == 'color' %} {{ checkbox_group('Color', 'color', facets.color, selected.color) }} {% elif key == 'price' %} {{ checkbox_group('Price', 'price', facets.price, selected.price) }} {% elif key == 'brand' %} {{ checkbox_group('Brand', 'brand', facets.brand, selected.brand) }} {% endif %} {% endfor %}
    Clear All
    {% endmacro %} {% macro load_more(batch, action, params) %} {% if batch.has_more %}
    {% for key, value in params.items() %} {% if value is iterable and value is not string %} {% for entry in value %}{% endfor %} {% else %}{% endif %} {% endfor %}
    {% endif %} {% endmacro %}