Difference between revisions of "Liquid Template Variables - collection"
From Spiffy Stores Knowledge Base
Line 22: | Line 22: | ||
== <code>collection.products</code> == | == <code>collection.products</code> == | ||
+ | |||
+ | Returns a collection of all products that are associated with this collection, matching the current view. The current view is takes into account things like pagination and selected tags. You can access each product using a ''for'' iteration. | ||
+ | |||
+ | <pre>{% for product in collection.products %} | ||
+ | {{ product.title }} | ||
+ | {% endfor %}</pre> | ||
== <code>collection.all_products</code> == | == <code>collection.all_products</code> == |
Revision as of 15:25, 15 September 2008
The liquid template variable collection has the following attributes:
Contents
collection.id
Returns the unique internal number of the collection.
This is normally only for internal usage.
collection.handle
This is the collection handle. The handle uniquely identifies the collection in the URL address.
The handle is usually the collection's title in lower case with all blanks replaced by a dash. "Summer Sale" would have the handle "summer-sale".
collection.title
Returns the title of this collection.
collection.description
Returns the description of this collection.
collection.products
Returns a collection of all products that are associated with this collection, matching the current view. The current view is takes into account things like pagination and selected tags. You can access each product using a for iteration.
{% for product in collection.products %} {{ product.title }} {% endfor %}