{% extends "pages/page.html" %}

{% load mezzanine_tags shop_tags i18n %}

{% block main %}{{ block.super }}

{% editable page.category.content %}
{{ page.category.content|safe }}
{% endeditable %}

<div class="category">

{% with page.category.children.active as child_categories %}
{% if child_categories %}
<ul class="categories">
	{% for category in child_categories %}
	<li><a href="{{ category.get_absolute_url }}">{{ category.title }}</a></li>
	{% endfor %}
</ul>
{% endif %}
{% endwith %}

{% ifnotequal products.paginator.count 0 %}
    {% product_sorting products %}
    <ul class="products">
	    {% for product in products.object_list %}
	    <li>
		    <a href="{{ product.get_absolute_url }}">
		        <div class="img">
			        {% if product.image %}
			        <img src="{{ MEDIA_URL }}{% thumbnail product.image 90 90 %}" />
			        {% endif %}
		        </div>
		        {{ product }}
	        </a>
            {% if product.has_price %}
	        <p class="price">
	            {% if product.on_sale %}
		            <span class="old-price">{{ product.unit_price|currency }}</span>
		            {% trans "On sale:" %}
	            {% endif %}
	            {{ product.price|currency }}
	        </p>
            {% endif %}
	    </li>
	    {% endfor %}
    </ul>
    {% product_paging products %}
{% endifnotequal %}

</div>
{% endblock %}

