{% macro card(product) %}
<article id="{{ product.getId() }}" class="product unselectable">
	<img src="/images/{{ product.getKey() }}/1.jpg" alt="{{ product.title.ru }}" ondrugstart="return false;"
		onclick="return core.catalog.product({{ product.getKey() }});">
	<a class="title" title="{{ product.title.ru }}" onclick="return core.catalog.product({{ product.getKey() }});">{{
		product.title.ru | length > 35 ? product.title.ru | slice(0, 35) ~ '...' : product.title.ru }}</a>
	<button title="Добавить в корзину" onclick="return core.catalog.cart.add({{ product.getKey() }})">{{ product.cost
		}}р</button>
</article>
{% endmacro %}

{% if products is not empty %}
<section class="unselectable" data-section="catalog" data-catalog-type="products" data-catalog-level="{{ level ?? 0 }}">
	<div class="column">
		{% for product in products %}
		{% if loop.index0 % 3 == 0 %}
		{{ _self.card(product) }}
		{% endif %}
		{% endfor %}
	</div>
	<div class="column">
		{% for product in products %}
		{% if loop.index0 % 3 == 1 %}
		{{ _self.card(product) }}
		{% endif %}
		{% endfor %}
	</div>
	<div class="column">
		{% for product in products %}
		{% if loop.index0 % 3 == 2 %}
		{{ _self.card(product) }}
		{% endif %}
		{% endfor %}
	</div>
</section>
{% endif %}
