{{ header }}
<div class="category-page">
  <div class="container">
    <ul class="breadcrumb">
      {% set i = 0 %}
	  {% for breadcrumb in breadcrumbs %}
	  {% set i = i + 1 %}
	  <li itemscope itemprop="itemListElement" itemtype="http://schema.org/ListItem">
	  <a href="{{ breadcrumb.href }}" itemprop="item">
	  <span itemprop="name">{{ breadcrumb.text }}</span>
      <meta itemprop="position" content="{{ i }}">
	  </a>
	  </li>
	  {% endfor %}
      <li itemscope itemprop="itemListElement" itemtype="http://schema.org/ListItem">
	  <span itemprop="name">{{ breadlast.text }}</span>
	  <meta itemprop="position" content="{{ i + 1 }}">
	  </li>
    </ul>
    <div class="row">
      <div class="col-sm-5"><h1>{{ heading_title }}</h1></div>
      <div class="col-sm-7">
      <div class="sort-block">
        <div id="cat-select" class="w-select hidden">
          <div class="bline">{{ heading_title }}</div>
		  <select class="no-select" onchange="location = this.value;">
		  <option value="" selected="selected">{{ heading_title }}</option>
		  {% for category in categories %}
		  <option value="{{ category.href }}">{{ category.name }}</option>
		  {% endfor %}
		  </select>
        </div>
        <span>{{ text_sort }}</span>  
		<div id="sort-select" class="w-select">
		  <div class="bline"></div>
          <select id="input-sort" class="no-select" onchange="location = this.value;">
          {% set var = '-' %}
		  {% for sorts in sorts %}
          {% if sorts.value == sort~var~order %}
          <option value="{{ sorts.href }}" selected="selected">{{ sorts.text }}</option>
          {% else %}
          <option value="{{ sorts.href }}">{{ sorts.text }}</option>
          {% endif %}
          {% endfor %}
          </select>
		</div>
		<span>{{ text_limit }}</span>
		<div id="limit-select" class="w-select">
		  <div class="bline">{{ limit }}</div>
		  <select id="input-limit" class="no-select" onchange="location = this.value;">
            {% for limits in limits %}
            {% if limits.value == limit %}
            <option value="{{ limits.href }}" selected="selected">{{ limits.text }}</option>
            {% else %}
            <option value="{{ limits.href }}">{{ limits.text }}</option>
            {% endif %}
            {% endfor %}
          </select>
		</div>
      </div>
      </div>
    </div>
    {{ content_top }}
    <div class="row-flex">
	  {{ column_left }}
      {% if column_left and column_right %}
    {% set class = 'col-sm-6' %}
    {% set gclass = 'product-layout product-grid col-lg-6 col-md-6 col-sm-12 col-xs-12' %}
	{% elseif column_left or column_right %}
    {% set class = 'col-sm-9 column-center' %}
	{% set gclass = 'product-layout product-grid col-lg-3 col-md-4 col-sm-6 col-xs-12' %}
    {% else %}
    {% set class = 'col-sm-12' %}
	{% set gclass = 'product-layout product-grid col-lg-3 col-md-3 col-sm-6 col-xs-12' %}
    {% endif %}
    {% if products %}
          <div id="content" class="{{ class }} column-center">
          <div class="row row-c">
            {% for product in products %}
            <div class="{{ gclass }} hoverimg" data-sw="{{ product.swap }}">
				<div class="product-thumb">
				{% if product.rating %}
				<ul class="rating list-unstyled">
				{% for j in 1..5 %}
				  {% if product.rating < j %}
				  <li class="nocheck"></li>
				  {% else %}
				  <li></li>
				  {% endif %}
				{% endfor %}
				</ul>
				{% endif %}
				<div class="sale">{{ product.sale }}</div>
				<div class="image"><a href="{{ product.href }}"><img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-responsive rel{{ product.product_id }}" /></a></div>
				<div class="l-icon">
					{% if iwishlist %}<i class="fa fa-heart-o" onclick="wishlist.add('{{ product.product_id }}','rel{{ product.product_id }}');"><span>{{ button_wishlist }}</span></i>{% endif %}
					{% if icompare %}<i class="fa fa-exchange" onclick="compare.add('{{ product.product_id }}','rel{{ product.product_id }}');"><span>{{ button_compare }}</span></i>{% endif %}
					{% if iview %}<i class="fa fa-eye" data-href="{{ product.href }}"><span>{{ button_view }}</span></i>{% endif %}
					{% if icart == 1 and not product.options %}
                    {% if product.istock %}
                    <i class="m-cart no-stock"><div class="picon"><div class="all-icon cart-icon"></div></div><span>{{ text_nostock }}</span></i>
                    {% else %}
                    <i class="m-cart" onclick="cart.add('{{ product.product_id }}','rel{{ product.product_id }}');"><div class="picon"><div class="all-icon cart-icon"></div></div><span>{{ button_cart }}</span></i>
                    {% endif %}
                    {% endif %}
				</div>
				<div class="caption">
				  <div class="hp">
		           {{ product.hit }}
		           {{ product.new }}
		           </div>
				  <h4><a href="{{ product.href }}">{{ product.name }}</a></h4>
				  {% if product.price %}
					<p class="price">
					{% if not product.special %}
					  {{ product.price }}
					{% else %}
					  <span class="price-new">{{ product.special }}</span> <span class="price-old">{{ product.price }}</span>
					{% endif %}
					{% if product.tax %}
					  <span class="price-tax">{{ text_tax }} {{ product.tax }}</span>
					{% endif %}
					</p>
				  {% endif %}
				</div>
				<div class="more-point">+</div>
				{% if icart == 2 and not product.options %}
				{% if product.istock %}
				<div class="picon c-icon no-stock" data-toggle="tooltip" title="" data-original-title="{{ text_nostock }}"><div class="all-icon cart-icon"></div></div>
				{% else %}
				<div class="picon c-icon" onclick="cart.add('{{ product.product_id }}','rel{{ product.product_id }}');"><div class="all-icon cart-icon"></div></div>
				{% endif %}
				{% endif %}
				<div class="info-block">
				  {% if product.attribute_groups %}
				  <ul class="attribute">
					{% for attribute_group in product.attribute_groups %}
					<tbody>
					  {% for attribute in attribute_group.attribute %}
					  {% if attribute.attribute_id not in attribute_out %}
					  {% if attribute_name %}{{ attribute.name }} -{% endif %}{{ attribute.text }} <span>|</span>
					  {% endif %}
					  {% endfor %}
					</tbody>
					{% endfor %}
				  </ul>
				  {% endif %}
				  {% if product.options %}
					<div class="size-block">		
					{% for option in product.options %}
					  {% if option.option_id == option_name %}
						{% for option_value in option.product_option_value %}
						<label class="{{ option_value.quantity < 1 ? ' out'}}"><input type="radio" name="option[{{ option.product_option_id }}]" value="{{ option_value.product_option_value_id }}" data-id="{{ product.product_id }}" data-uid="rel{{ product.product_id }}">{{ option_value.name }}</label>
						{% endfor %}
					  {% endif %}
					{% endfor %}
					</div>
				  {% endif %}
				  {% if product.min_d %}
				  <div class="des-block">{{ product.min_d }}</div>
				  {% endif %}
				</div>
			  </div>
            </div>
            {% endfor %}
          </div>
          {{ pagination }}
        </div>
        {% else %}
          <div id="content" class="{{ class }} no-product">
          <p class="empty">{{ text_empty }}</p>
          </div>
        {% endif %}
      {{ column_right }}
	</div>
    {% if description %}
    <div class="cdes-block">
      <div class="row">
      <div class="col-sm-6">{{ description }}</div>
      </div>
    </div>
  {% endif %}
  </div>
  {{ content_bottom }}
</div>
{{ footer }}