Object: collection
Variables
.id
Unique ID of the collection. Collection IDs are generated automatically at the time of creating the collection and cannot be changed.
Examples
CODE{{ collection.id }}
OUTPUT1123
CODE{{ collection.id | collection_url }}
OUTPUT/collection/notebooks
NB: the exact URL depends on the Collection URL configuration.
CODE{{ collection.id | collection_link: 'see all notebooks' }}
OUTPUT<a href="/collection/notebooks">see all notebooks</a>
NB: the exact URL depends on the Collection URL configuration
.ref
Unique reference name of the collection, based on configuration under Collection » Update » Reference name.
Examples
CODE{{ collection.ref }}
OUTPUTnotebooks
URLs
Do not use .ref
to construct a collection URL manually. Use the collection_url
filter instead, on either the .id, .ref or the collection object itself.
.name
Display name of the collection as configured under Collection » Update » Name.
Examples
CODE{{ collection.name }}
OUTPUTNotebooks
.products
List of products within the collection.
Examples
CODE{% for product in collection.products %}
{{ product.name }} @ {{ product.price | money }}<br/>
{% endfor %}
OUTPUTSony Vaio 13" Notebooks @ USD 999.95
Sony Vaio 15" Notebooks @ USD 799.95
...
Variable Dump
Copy and paste the below HTML into a collection type template page, to see all collection data dumped to your collection page. You can then simply remove the unnecessary fields and other elements, and format the remaining fields however necessary to achieve the desired look and feel.
<style> .thedump .name{ background-color:#3A5FCD; color:white; padding:0.5em; font-weight:bold; } .thedump .code{ background-color:#888888; color:white; padding:0.5em; } .thedump .out{ background-color:white; color:#555555; padding:0.5em; border-bottom:1px solid #CCCCCC; margin-bottom:1em; } .thedump .code pre{ padding:0; margin:0; font-size:1.1em; } </style> <div class="thedump"> <div class="name">Collection ID</div> <div class="code"><pre>{{ collection.id }}</pre></div> <div class="out">{{ collection.id }}</div> <div class="name">Collection URL</div> <div class="code"><pre>{{ collection | collection_url }}</pre></div> <div class="out">{{ collection | collection_url }}</div> <div class="name">Collection Reference</div> <div class="code"><pre>{{ collection.ref }}</pre></div> <div class="out">{{ collection.ref }}</div> <div class="name">Collection Name</div> <div class="code"><pre>{{ collection.name }}</pre></div> <div class="out">{{ collection.name }}</div> <div class="name">Collection Featured Image</div> <div class="code"><pre>id: {{ collection.featured_image.id }}<br/> alt: {{ collection.featured_image.alt }}<br/> notes: {{ collection.featured_image.notes }}<br/> {{ collection.featured_image.src }}<br/> {{ collection.featured_image.src | img_tag }}<br/> {% for variant in collection.featured_image.variants %} {{ variant.ref }}<br/> {{ variant.src }}<br/> {{ variant.src | img_tag }}<br/> {% endfor %} {{ collection.featured_image.variants.small.src }}<br/> {{ collection.featured_image.variants.small.src | img_tag }}<br/></pre></div> <div class="out"> id: {{ collection.featured_image.id }}<br/> alt: {{ collection.featured_image.alt }}<br/> notes: {{ collection.featured_image.notes }}<br/> {{ collection.featured_image.src }}<br/> {{ collection.featured_image.src | img_tag }}<br/> {% for variant in collection.featured_image.variants %} {{ variant.ref }}<br/> {{ variant.src }}<br/> {{ variant.src | img_tag }}<br/> {% endfor %} {{ collection.featured_image.variants.small.src }}<br/> {{ collection.featured_image.variants.small.src | img_tag }}<br/> </div> <div class="name">Products</div> <div class="code"><pre>{% for product in collection.products %} <p> id: {{ product.id }}<br/> reference: {{ product.ref }}<br/> name: {{ product.name }} url: {{ product | product_url }} link: {{ product | product_link: product.name }} </p> {% endfor %}</pre></div> <div class="out"> {% for product in collection.products %} <p> id: {{ product.id }}<br/> reference: {{ product.ref }}<br/> name: {{ product.name }}<br/> url: {{ product | product_url }}<br/> link: {{ product | product_link: product.name }} </p> {% endfor %} </div> </div>