{{ header }}
{{breadcrumb}} 
<section class="ptb-95">
  <div id="product-search" class="container">
    
    <div class="row">{{ column_left }}
      {% if column_left and column_right %}
        {% set class = 'col-xl-8 col-lg-6 col-lgmd-60per' %}
      {% elseif column_left or column_right %}
        {% set class = 'col-xl-10 col-lg-9 col-lgmd-80per' %}
      {% else %}
        {% set class = 'col-md-12' %}
      {% endif %}
      <div id="content" class="{{ class }}">{{ content_top }}

        <label class="control-label" for="input-search">{{ entry_search }}</label>
        <div class="mb-20 search-criteria">
          <div class="row">
            <div class="col-md-3">
              <div class="searching-fild">
                <input type="text" name="search" value="{{ search }}" placeholder="{{ text_keyword }}" id="input-search" class="form-control" />
              </div>
            </div>
            <div class="col-md-3">
              <div class="searching-fild">
                <select name="category_id" class="form-control">
                  <option value="0">{{ text_category }}</option>
                  {% for category_1 in categories %}
                  {% if category_1.category_id == category_id %}
                  <option value="{{ category_1.category_id }}" selected="selected">{{ category_1.name }}</option>
                  {% else %}
                  <option value="{{ category_1.category_id }}">{{ category_1.name }}</option>
                  {% endif %}
                  {% for category_2 in category_1.children %}
                  {% if category_2.category_id == category_id %}
                  <option value="{{ category_2.category_id }}" selected="selected">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ category_2.name }}</option>
                  {% else %}
                  <option value="{{ category_2.category_id }}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ category_2.name }}</option>
                  {% endif %}
                  {% for category_3 in category_2.children %}
                  {% if category_3.category_id == category_id %}
                  <option value="{{ category_3.category_id }}" selected="selected">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ category_3.name }}</option>
                  {% else %}
                  <option value="{{ category_3.category_id }}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ category_3.name }}</option>
                  {% endif %}
                  {% endfor %}
                  {% endfor %}
                  {% endfor %}
                </select>
              </div>
            </div>
            <div class="col-md-3">
                <div class="searching-fild">
                  <label class="checkbox-inline">
                    {% if sub_category %}
                    <input type="checkbox" name="sub_category" value="1" checked="checked" />
                    {% else %}
                    <input type="checkbox" name="sub_category" value="1" />
                    {% endif %}
                    {{ text_sub_category }}
                  </label>
                </div>
            </div>
            <div class="col-md-3">
              <div class="searching-fild">
                <label class="checkbox-inline">
                  {% if description %}
                  <input type="checkbox" name="description" value="1" id="description" checked="checked" />
                  {% else %}
                  <input type="checkbox" name="description" value="1" id="description" />
                  {% endif %}
                  {{ entry_description }}
                </label>
              </div>
            </div>
          </div>
          <input type="button" value="{{ button_search }}" id="button-search" class="btn full btn-color" />
        </div>

        <p>
          
        </p>
        
        <h2>{{ text_search }}</h2>
        {% if products %}
        <div class="shorting mb-30">
          <div class="row">
            <div class="col-lg-6">
              <div class="view">
                <div class="list-types active">
                    <div id="grid-view" class="grid-icon grid list-types-icon" data-toggle="tooltip" title="{{ button_grid }}"></div>
                </div>
                <div class="list-types ">
                  <div id="list-view" class="list-icon list list-types-icon" data-toggle="tooltip" title="{{ button_list }}"></div>
                </div>
              </div>
              <div class="short-by float-right-sm">
                <span>{{ text_sort }}</span>
                <div class="select-item">
                  <select id="input-sort" 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>
            <div class="col-lg-6">
              <div class="show-item right-side float-left-sm">
                <div class="show-item left-side">
                  <span>{{ text_limit }}</span>
                  <div class="select-item">
                    <select id="input-limit" 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>
                  <span>{{ text_per_page }}</span>
                </div>
                <div class="compare float-right">
                  <a class="btn btn-color" href="{{ compare }}">{{ text_compare }}</a>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="product-listing">
          <div class="inner-listing">
            <div class="row mlr_-20">
              {% for product in products %}
                <div class="col-md-4 col-6 product-grid item-width plr-20 mb-30">
                  {{product}}
                  {# <div class="product-thumb">
                    <div class="image">

                      {% if product.thumb_swap %}
                        <a href="{{product.href}}">
                          <img src="{{product.thumb}}" title="{{product.name}}" alt="{{product.name}}" class="img-responsive"/>
                          <img class="img-responsive hover-image" src="{{product.thumb_swap}}" alt="{{product.name}}"/>
                        </a>
                        {% if product.special is not empty %}
                          <div class="sale-label"><span>Sale</span></div>
                        {% endif %}

                      {% else %}
                        <a href="{{product.href}}">
                            <img src="{{product.thumb}}" title="{{product.name}}" alt="{{product.name}}" class="img-responsive"/>
                        </a>
                        {% if product.special is not empty %}
                            <div class="sale-label"><span>Sale</span></div>
                        {% endif %}
                      {% endif %}

                      <div class="button-group main-product-btn product-item-action">
                         <div class="button-inner">
                          <div class="hover-actions">
                           <button  class="addtocart" type="button" onclick="cart.add('{{product.product_id}}')"><span class="icon"><!-- fa fa-shopping-cart --></span> </button>
                           <button class="whishlist" type="button" data-toggle="tooltip" title="{{button_wishlist}}" onclick="wishlist.add('{{product.product_id}}')"><span class="icon"></span></button>
                           <button class="compare" type="button" data-toggle="tooltip" title="{{button_compare}}" onclick="compare.add('{{product.product_id}}')"><span class="icon"><!-- fa fa-exchange --></span></button>
                              <a class='quickview iframe button' href="{{product.quick}}"><span class="icon"></span></a>
                          </div>
                         </div>  
                      </div>
                    </div>
                    <div>
                      <div class="caption">
                        <div class="name">
                          <h3><a href="{{ product.href }}">{{ product.name }}</a></h3>
                        </div>

				{# start owc_core_productpageenhanced_hooks_twig.xml #}
				{# HOOK_PRODUCTPAGEENHANCED_LIST_BEFORE_PRICE #}
				{# end owc_core_productpageenhanced_hooks_twig.xml #}
				
                        {% 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 class="rating">
                          {% for i in 1..5 %}
                          {% if product.rating < i %}
                          <span class="fa fa-stack"><i class="fa fa-star 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 fa-stack-2x"></i></span>
                          {% endif %}
                          {% endfor %}
                        </div>
                        

                        <p class="category-description">{{ product.description }}</p>
                        
                        <div class="button-group main-product-btn product-item-action">
                           <div class="button-inner">
                            <div class="hover-actions">
                             <button  class="addtocart" type="button" onclick="cart.add('{{product.product_id}}','{{ product.minimum }}');"><span class="icon"></span> </button>
                             <button class="whishlist" type="button" data-toggle="tooltip" title="{{button_wishlist}}" onclick="wishlist.add('{{product.product_id}}');"><span class="icon"></span></button>
                             <button class="compare" type="button" data-toggle="tooltip" title="{{button_compare}}" onclick="compare.add('{{product.product_id}}')"><span class="icon"></span></button>
                                <a class='quickview iframe button' href="{{product.quick}}"><span class="icon"></span></a>
                             </div>
                           </div>  
                        </div>
                      </div>
                    </div>
                  </div> #}
                </div>
              {% endfor %}
            </div>
          </div>
        </div>
        <div class="toolbar toolbar-products row">
          <div class="col-md-6 center-xs"> 
            <div class="pagination-bar"> 
              {{ pagination }}
            </div>
          </div>
          <div class="col-md-6 per-page-bottom align-right center-xs">{{ results }}</div>
        </div>
        {% else %}
          <p>{{ text_empty }}</p>
        {% endif %}
        {{ content_bottom }}</div>
      {{ column_right }}</div>
  </div>
</section>
<script type="text/javascript"><!--
$('#button-search').bind('click', function() {
	url = 'index.php?route=product/search';

	var search = $('#content input[name=\'search\']').prop('value');

	if (search) {
		url += '&search=' + encodeURIComponent(search);
	}

	var category_id = $('#content select[name=\'category_id\']').prop('value');

	if (category_id > 0) {
		url += '&category_id=' + encodeURIComponent(category_id);
	}

	var sub_category = $('#content input[name=\'sub_category\']:checked').prop('value');

	if (sub_category) {
		url += '&sub_category=true';
	}

	var filter_description = $('#content input[name=\'description\']:checked').prop('value');

	if (filter_description) {
		url += '&description=true';
	}

	location = url;
});

$('#content input[name=\'search\']').bind('keydown', function(e) {
	if (e.keyCode == 13) {
		$('#button-search').trigger('click');
	}
});

$('select[name=\'category_id\']').on('change', function() {
	if (this.value == '0') {
		$('input[name=\'sub_category\']').prop('disabled', true);
	} else {
		$('input[name=\'sub_category\']').prop('disabled', false);
	}
});

$('select[name=\'category_id\']').trigger('change');
--></script>
{{ footer }}