{% extends "shop/base.html" %}
{% load i18n %}
{% load thumbnail %}
{% load satchmo_category %}

{% block extra-head %}
{% if category.meta %}
    <meta name="description" content="{{ category.meta|escape }}">
{% endif %}
{% endblock %}

{% block navbar %}
    <li class="first"><a href="{{ shop_base }}/">{% trans "Home" %}</a></li>
	{% for parent in category.parents %}<li><a href="{{ parent.get_absolute_url }}">{{ parent.translated_name }}</a></li>{% endfor %}
	<li>{{ category.translated_name }}</li>
{% endblock %}

{% block content %}
<div id="product_category">
<h3>{{ category.translated_name }}</h3>
{% if category.translated_description %}<p class="product_category_description">{{ category.translated_description }}</p>{% endif %}
    {% if category.main_image %}
            {% thumbnail category.main_image.picture 85x85 as image %}
           <img src="{{ image }}" width="{{ image.width }}" height="{{ image.height }}" />
    {% endif %}
    {% for product in products %} 
        {% if forloop.first %} <ul>  {% endif %}
            <li>{% thumbnail product.main_image.picture 85x85 as image %}
            <a href="{{ product.get_absolute_url }}"><img src="{{ image }}" width="{{ image.width }}" height="{{ image.height }}" /></a>
            <a href="{{ product.get_absolute_url }}">{{ product.translated_name }}</a></li>
        {% if forloop.last %} </ul> {% endif %}
    {% endfor %}
{% if child_categories %}
        {% for cat in child_categories %}
            <h4>{{cat.translated_name}}</h4>
            {% if cat.translated_description %}<p class="product_category_description">{{ cat.translated_description }}</p>{% endif %}
            {% for product in cat.active_products %}
                {% if forloop.first %} <ul>  {% endif %}
                    <li>{% thumbnail product.main_image.picture 85x85 as image %}
                    <a href="{{ product.get_absolute_url }}"><img src="{{ image }}" width="{{ image.width }}" height="{{ image.height }}" /></a>
                <a href="{{ product.get_absolute_url }}">{{ product.translated_name }}</a></li>
                {% if forloop.last %} </ul> {% endif %}
            {% endfor %}
        {% endfor %}
{% endif %}
{% if sale %}
{% include "product/some_discount_eligible.html" %}
{% endif %}
</div>
{% endblock %}
