{{ header }}
<div id="container" class="container j-container">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
      <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="{{ breadcrumb.href }}" itemprop="url"><span itemprop="title">{{ breadcrumb.text }}</span></a></li>
    {% endfor %}
  </ul>
  <div class="row">{{ column_left }}{{ column_right }}
    {% if column_left and column_right %}
      {% set class = 'col-sm-6' %}
    {% elseif column_left or column_right %}
      {% set class = 'col-sm-9' %}
    {% else %}
      {% set class = 'col-sm-12' %}
    {% endif %}
    <div id="content" class="{{ class }}">
      <h1 class="heading-title">{{ heading_title }}</h1>
      {{ content_top }}
      {% if products %}
        <div class="product-filter">
          <div class="display">
            <a onclick="Journal.gridView()" class="grid-view">{{ journal2.settings.get('category_grid_view_icon', button_grid) }}</a>
            <a onclick="Journal.listView()" class="list-view">{{ journal2.settings.get('category_list_view_icon', button_list) }}</a>
          </div>
          <div class="product-compare"><a href="{{ compare }}" id="compare-total">{{ text_compare }}</a></div>
          <div class="limit"><b>{{ text_limit }}</b>
            <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 class="sort"><b>{{ text_sort }}</b>
            <select onchange="location = this.value;">
              {% for sorts in sorts %}
                {% if sorts.value == '%s-%s'|format(sort, order) %}
                  <option value="{{ sorts.href }}" selected="selected">{{ sorts.text }}</option>
                {% else %}
                  <option value="{{ sorts.href }}">{{ sorts.text }}</option>
                {% endif %}
              {% endfor %}
            </select>
          </div>
        </div>
        <div class="row main-products product-grid" data-grid-classes="{{ journal2.settings.get('product_grid_classes') }} display-{{ journal2.settings.get('product_grid_wishlist_icon_display') }} {{ journal2.settings.get('product_grid_button_block_button') }}">
          {% for product in products %}
            <div class="product-grid-item {{ journal2.settings.get('product_grid_classes') }}">
              <div class="product-thumb product-wrapper {% if product.labels and product.labels.outofstock %} outofstock {% endif %}">
                <div class="image {% if journal2.settings.get('show_countdown', 'never') != 'never' and product.date_end %} has-countdown {% endif %}">
                  <a href="{{ product.href }}" {% if product.thumb2 %} class="has-second-image" style="background: url('{{ product.thumb2 }}') no-repeat" {% endif %}>
                    <img class="lazy first-image" width="{{ journal2.settings.get('config_image_width') }}" height="{{ journal2.settings.get('config_image_height') }}" src="{{ journal2.settings.get('product_dummy_image') }}" data-src="{{ product.thumb }}" title="{{ product.name }}" alt="{{ product.name }}"/>
                  </a>
                  {% for label, name in product.labels %}
                    <span class="label-{{ label }}"><b>{{ name }}</b></span>
                  {% endfor %}
                  {% if journal2.settings.get('product_grid_wishlist_icon_position') == 'image' and journal2.settings.get('product_grid_wishlist_icon_display') == 'icon' %}
                    <div class="wishlist"><a onclick="addToWishList('{{ product.product_id }}');" class="hint--top" data-hint="{{ button_wishlist }}"><i class="wishlist-icon"></i><span class="button-wishlist-text">{{ button_wishlist }}</span></a></div>
                    <div class="compare"><a onclick="addToCompare('{{ product.product_id }}');" class="hint--top" data-hint="{{ button_compare }}"><i class="compare-icon"></i><span class="button-compare-text">{{ button_compare }}</span></a></div>
                  {% endif %}
                </div>
                <div class="product-details">
                  <div class="caption">
                    <h4 class="name"><a href="{{ product.href }}">{{ product.name }}</a></h4>
                    <p class="description">{{ product.description }}</p>
                    {% if product.price %}
                      <div class="price">
                        {% if not product.special %}
                          {{ product.price }}
                        {% else %}
                          <span class="price-old">{{ product.price }}</span> <span class="price-new" {% if product.date_end %}data-end-date="{{ product.date_end }}"{% endif %}>{{ product.special }}</span>
                        {% endif %}
                        {% if product.tax %}
                          <span class="price-tax">{{ text_tax }} {{ product.tax }}</span>
                        {% endif %}
                      </div>
                    {% endif %}
                    {% if product.rating %}
                      <div class="rating">
                        {% for i in 1..5 %}
                          {% if product.rating < i %}
                            <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
                          {% else %}
                            <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
                          {% endif %}
                        {% endfor %}
                      </div>
                    {% endif %}
                  </div>
                  <div class="button-group">
                    {% if staticCall('Journal2Utils', 'isEnquiryProduct', [null, product]) %}
                      <div class="cart enquiry-button">
                        <a href="javascript:Journal.openPopup('{{ journal2.settings.get('enquiry_popup_code') }}', '{{ product.product_id }}');" data-clk="addToCart('{{ product.product_id }}');" class="button hint--top" data-hint="{{ journal2.settings.get('enquiry_button_text') }}">{{ journal2.settings.get('enquiry_button_icon') }}<span class="button-cart-text">{{ journal2.settings.get('enquiry_button_text') }}</span></a>
                      </div>
                    {% else %}
                      <div class="cart {% if product.labels and product.labels.outofstock %} outofstock {% endif %}">
                        <a onclick="addToCart('{{ product.product_id }}', '{{ product.minimum }}');" class="button hint--top" data-hint="{{ button_cart }}"><i class="button-left-icon"></i><span class="button-cart-text">{{ button_cart }}</span><i class="button-right-icon"></i></a>
                      </div>
                    {% endif %}
                    <div class="wishlist"><a onclick="addToWishList('{{ product.product_id }}');" class="hint--top" data-hint="{{ button_wishlist }}"><i class="wishlist-icon"></i><span class="button-wishlist-text">{{ button_wishlist }}</span></a></div>
                    <div class="compare"><a onclick="addToCompare('{{ product.product_id }}');" class="hint--top" data-hint="{{ button_compare }}"><i class="compare-icon"></i><span class="button-compare-text">{{ button_compare }}</span></a></div>
                  </div>
                </div>
              </div>
            </div>
          {% endfor %}
        </div>
        <div class="row pagination">
          <div class="col-sm-6 text-left links">{{ pagination }}</div>
          <div class="col-sm-6 text-right results">{{ results }}</div>
        </div>
      {% else %}
        <p>{{ text_empty }}</p>
        <div class="buttons">
          <div class="pull-right"><a href="{{ continue }}" class="button btn btn-primary">{{ button_continue }}</a></div>
        </div>
      {% endif %}
      {{ content_bottom }}</div>
  </div>
  <script>Journal.applyView('{{ journal2.settings.get('product_view', 'grid') }}');</script>
  {% if journal2.settings.get('show_countdown', 'never') != 'never' %}
    <script>Journal.enableCountdown();</script>
  {% endif %}
</div>
{{ footer }}
