header partial

The header.twig partial hosts the header of your theme. The header is usually shown on every page of your website and is referenced from master.twig.


Category menu

The header will usually display a category menu. This is returned using the global.categories object.

<ul>
    {% for category in global.categories %}
        <li>
            {% if category.categories %}<!-- detect whether the category has subcategories -->
                <a href="{{ category.url }}">{{ category.title }}</a>
                <ul>
                    {% for subcategory in category.categories %}</span></span></span>
                        <li>
                            <a href="{{ subcategory.url }}">{{ subcategory.title }}</a>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                <a href="{{ category.url }}">{{ category.title }}</a>
            {% endif %}
        </li>
    {% endfor %}
</ul>

Brand menu

The header will also usually display a brand menu. This is returned using the global.brands object.

{% if global.brands %}
    <li>
        <a href="/brands">
            Brands
        </a>
        <ul class="vertical menu">
            {% for brand in global.brands %}
                <li>
                    <a href="{{ brand.url }}">
                        {{ brand.title }}
                    </a>
                </li>
            {% endfor %}
        </ul>
    </li>
{% endif %}

Search form

The header usually hosts a product search form.


Currencies

If the multi-currency APP is installed/enabled you will be able to display the current currency as well as links for a visitor to change their currency.

These are returned using the global.currencies object.


Logo

The logo file uploaded in the business account is returned using the global.business.logo_url variable.


Items in the basket

The number of items in the shopping basket can be returned with the variable global.basket.items and the value of items in the basket is returned with the variable global.basket.value.


Items in the wishlist

The number of items in the visitor's wishlist can be returned with the variable global.wishlist.items.