collection template

The collection.twig template can be used to provide a template for the categories, brands, category and brand pages. Using the collection template you can give all your product related pages a common theme and code architecture.

The collection template extends the page template.


Title & description

The title and description can be set on the individual view, e.g.

{% set title = category.title %}

and then referenced within the template with the {{ title }} variable.


Showing a sidebar

Pages like the category or brand page may include a side menu. The show_sidebar variable can be set on, for example, the category view and then referenced within collection.


Sorting products

Users are able to sort products depending on the criteria they choose.

<form action="{{ global.current_url }}" method="get">
    <select name="sort" class="sort-drop-down">
        <option value="sort_order_asc"{{ sort_option == 'sort_order_asc' ? ' selected="selected"' : '' }}>Relevance</option>
        <option value="price_asc"{{ sort_option == 'price_asc' ? ' selected="selected"' : '' }}>Price (Low - High)</option>
        <option value="price_desc"{{ sort_option == 'price_desc' ? ' selected="selected"' : '' }}>Price (High - Low)</option>
        <option value="title_asc"{{ sort_option == 'title_asc' ? ' selected="selected"' : '' }}>Title (A - Z)</option>
        <option value="title_desc"{{ sort_option == 'title_desc' ? ' selected="selected"' : '' }}>Title (Z - A)</option>
        <option value="created" {{ sort_option == 'created' ? 'selected="selected"' : '' }}>Newest First</option>
    </select>
</form>