Skip to content

Instantly share code, notes, and snippets.

@Tetsuro
Created February 22, 2013 19:23
Show Gist options
  • Save Tetsuro/5015903 to your computer and use it in GitHub Desktop.
Save Tetsuro/5015903 to your computer and use it in GitHub Desktop.
Related products by Type
<div id="coll-product-list">
{% capture current_handle %}{{ product.handle }}{% endcapture %}
{% capture current_type %}{{ product.type }}{% endcapture %}
{% assign how_many_we_got = 0 %}
{% paginate collections.all-products.products by 100 %}
{% for product in collections.all-products.products %}
{% unless product.handle == current_handle %}
{% if product.type == current_type and how_many_we_got < 4 %}
{% assign how_many_we_got = how_many_we_got | plus: 1 %}
{% include 'snippet-product-item' with 'four' %}
{% endif %}
{% endunless %}
{% endfor %}
{% endpaginate %}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment