Filter By Release Date Drop down - LIQUID

This technique was first used on the We Are Vinyl web store. http://eu.wearevinyl.co.uk/collections/ac-dc

To add a release date to a product:

Navigate to a proudct and under the tags section use the following format:

release:year

So for example if an album was reased in 1987 the tag will look like:

release:1987

Include the release_date_filter.liquid on the collection page, below the default sort.

{% include 'release_date_filter' %}  

Release Date Filter Snippet

<section class="container release_date">  
  <div class="nav nav-pills dropdown">
    <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Sort By Release Date <span class="caret"></span></button>
      <ul class="dropdown-menu">
        {% for tag in collection.all_tags reversed %}
          {% if current_tags contains tag %}
            <li>
              {{ tag | link_to_tag: tag | remove: "release:" }}
            </li>
          {% else %}
            {% if tag contains 'release' %}
              <li class="">
                {{ tag | link_to_tag: tag | remove: "release:" }}
              </li>
            {% endif %}
          {% endif %}
        {% endfor %}
      </ul>
   </div>
</section>
<hr>

Leave a comment