carolineschnapp
4/3/2012 - 2:20 PM

How to filter a collection by vendor

How to filter a collection by vendor

<!-- add the vendor as product tag to product then use this code in collection.liquid -->
<!-- if we are on a collection page that is either custom or smart -->
{% if collection.url != blank %}
<h4>Shop by vendor:</h4>
<ul>
{% for product_vendor in collection.all_vendors %}
  <li>
    {% if current_tags contains product_vendor %}
    <a class="active" href="{{ collection.url }}">{{ product_vendor }}</a>
    {% else %}
    <a href="{{ collection.url }}/{{ product_vendor | handle }}">{{ product_vendor }}</a>
    {% endif %}
  </li>
{% endfor %}
</ul>
{% endif %}