{% if page.full_url contains "search=" or theme.collections != true or page.full_url contains '/category' %}
{% paginate products from products.current by theme.products_per_page %}
{% if products != blank %}
{% for product in products %}
{% assign image_width = product.image.width | times: 1.0 %}
{% assign image_height = product.image.height | times: 1.0 %}
{% assign aspect_ratio = image_width | divided_by: image_height %}
{% assign product_status = '' %}
{% case product.status %}
{% when 'active' %}
{% if product.on_sale %}{% assign product_status = 'On sale' %}{% endif %}
{% when 'sold-out' %}
{% assign product_status = 'Sold out' %}
{% when 'coming-soon' %}
{% assign product_status = 'Coming soon' %}
{% endcase %}
{% capture image_class %}
{% if product.image.height > product.image.width %}
image-tall
{% elsif product.image.height < product.image.width %}
image-wide
{% else %}
image-square
{% endif %}
{% endcapture %}
{% endfor %}
{% if paginate.pages > 1 %}
{% if paginate.previous.is_link %}
{% else %}
{% endif %}
{% if paginate.next.is_link %}
{% else %}
{% endif %}
Page {{ paginate.current_page }} of {{ paginate.pages }}
{% endif %}
{% else %}
No products found.
{% endif %}
{% endpaginate %}
{% else %}
{% if categories.active != blank %}
{% else %}
No products found.
{% endif %}
{% endif %}