+813-444-3589+44 118 328 3220+49-231-976765-0 | Contact us

Collection

All collection contains all products that have something in common (e.g. all action movies). Each product can be part of several collections. Also collections can contain sub-collections (e.g. martial-art action movies and police action movies), where each parent collection contains all products of the sub-collection.The collections are defined by the shop owner.

Each Collection object contains the following fields:

Variable name Object Description Note
all_products List<Product> A list of all products of the collection. This is still available for compatibility reasons, better use the field products instead.  
all_products_count int The number of products in the collection. This is still available for compatibility reasons, better use the field products_count instead.  
all_tags List<string> For now, tagging of products is not supported, therefore this list will always be empty. Best to use the AttributeFilter instead of tags.  
all_types List<string> This list contains all types as specified by all contained products in the field ‘type’.  
all_vendors List<string> This list contains all vendors as specified by all contained products in the field ‘vendor’.  
child_collections List<Collection> This list contains all collections that are sub-collections of this collection. Each such collection contains a subset of the products of this collection. EF
description string This string tells more information about the collection. It can (and will quite often) be empty.  
handle string An internal handle for this collection, which can be used to access a specific collection directly e.g. collections[collection.handle] returns the same collection as collection.  
id int An internal numerical id for the collection.  
image Image Specifies an image for the collection (which quite often doesn’t exists). For more information, please have a look at the Image object.  
next_product Product This field is only defined on the product template. In that case it will contain the next product of the current product regarding the given sort order.  
order_position int An internal position for sorting the collections regarding ascending order positions. The shop owner is able to specify a different ordering if desired. EF
path List<Collection> If being in a sub-collection, this list provides a kind of path from the top level to the current collection. The current collection is also included in this path. E.g. first entry in the list is the ‘Action’ collection (one of the top collections), the second entry is ‘Martial-Art’ and the third is ‘Bruce Lee’ (which is the current collection). This can be used for setting special classes for all collections along the path: EF
previous_product Product This field is only defined on the product template. In that case it will contain the previous product of the current product regarding the given sort order.  
products List<Product> A list of all products in this collection, sorted via the given sort order.  
products_count int Contains the number of products in this collection.  
seo_description string Returns the SEO Description for the current collection. EF
seo_keywords string Returns the SEO keywords list as one string EF
seo_title string Returns the SEO title for the collection EF
title string Title of the collection  
tags List<string> Not supported for this version of the shop system. Better use AttributeFilter instead.  
url string Contains the URL of the page showing this collection.  

Example:


{% for col1 in collections %}
  <div {% if collection.path contains col1 %}class="active"{% endif %}>
    {{ col1.title }}
  </div>
  {% if col1.child_collections %}
    {% for col2 in col1.child_collections %}
      ...
    {% endfor %}
  {% endif %}
{% endfor %}
		

Output:


<div >
  All
</div>
<div >
  Animation
</div>
<div class="active">
  Comedy
</div>
<div >
  Sci-Fi
</div>
<div >
  Best selling
</div>
<div >
  Best rated
</div>
		

Remark: Even though it is possible to build own menus with the collection list, the preferred way of creating collection menus is to use the LinkList object, which contains a predefined menu structure (also with sub-collections in sub-menus).

Note: Some parts (marked with EF) of this object are exclusive to FlickRocket. If you are using a theme orginating from Shopify and want to use this functionality, you need to add this.