{% if simpleView == true %}
{% set wireFrameFile = 'eshopLayoutSimple.html.php' %}
{% elseif wireFrame.wireFrameFile is defined %}
{% set wireFrameFile = wireFrame.wireFrameFile %}
{% else %}
{% set wireFrameFile = 'eshopLayoutBasic.html.php' %}
{% endif %}
{% extends wireFrameFile %}
{% block page_contents %}
{# {% if seoData is defined and seoData.seoTitle is defined %}#}
{# {% block title %}{{ seoData.seoTitle }}{% endblock %}#}
{# {% endif %}#}
{# {% if seoData is defined and seoData.seoDescription is defined %}#}
{# {% block description %}{{ seoData.seoDescription }}{% endblock %}#}
{# {% endif %}#}
{% if category.categoryDescription != '' %}
<div class="categoryDescription">{{ category.categoryDescription }}</div>
{% endif %}
{% if childNodes|length > 0 %}
<div class="subcategories">{{ 'eshop.subcategories'|trans }}:</div>
{% endif %}
{% for cat in childNodes %}
{% if cat.isActive %}
<a href="{{ path('root') }}eshop/{{ eshop.eshopId }}/category/{{ cat.categoryId }}" class="categoryBoxLink">
<div class="categoryBox2">
<div class="categoryBox">
<div class="categoryTitle">{{ cat.categoryName }}</div>
{% if cat.image1 != "" %}
{% if 'http' in cat.image1 %}
{% set imagePath = cat.image1 %}
{% set imageThumbPath = cat.image1 %}
{% else %}
{% set imagePath = cat.image1 %}
{% set imageThumbPath = 'users/' ~ user.userName ~ '/images/thumb_' ~ cat.image1 %}
{% endif %}
<!-- we display image thumb -->
<div class="categoryThumb">
<img src="{{ asset(imageThumbPath) }}" alt="Category Image" border="0" class="categoryThumbImg">
</div>
{% endif %}
</div>
</div>
</a>
{% endif %}
{% endfor %}
{% set productTemplate = 'eshopProduct_' ~ productView ~ '.html.twig' %}
<!-- navigator -->
<div class="navigator">
<span class="navigatorPath">
<!-- category path -->
<span class="productPath">
{% set catCount = 0 %}
{% for cat in categoryPath %}
{% if catCount == 0 %}
<a href="{{ path('root') }}eshop/{{ eshop.eshopId }}" class="pathLinkHome">{{ 'eshop.home'|trans }}</a>
{% endif %}
{% set catCount = catCount + 1 %}
{% if catCount == categoryPath|length %}
<span class="pathSeparator">|</span> <a href="{{ path('root') }}eshop/{{ eshop.eshopId }}/category/{{ cat.categoryId }}" class="pathLinkCurrent">{{ cat.categoryName }}</a>
{% else %}
<span class="pathSeparator">|</span> <a href="{{ path('root') }}eshop/{{ eshop.eshopId }}/category/{{ cat.categoryId }}" class="pathLink">{{ cat.categoryName }}</a>
{% endif %}
{% endfor %}
</span>
</span>
<span class="paginator">
{% if eshop.countPerPage is defined %}
{% set countPerPage = eshop.countPerPage %}
{% else %}
{% set countPerPage = 20 %}
{% endif %}
{% set pageCount = productCount / countPerPage %}
{% set pageTotal = pageCount|round(0, 'ceil') %}
{% if pageTotal == 0 %}
{% set pageTotal = pageTotal + 1 %}
{% endif %}
{% if app.request.get('page') is defined and app.request.get('page') %}
{% set currentPage = app.request.get('page') %}
{% else %}
{% set currentPage = 1 %}
{% endif %}
<span class="smallDescription">{{ 'system.pages'|trans }}: {{ currentPage }}/{{ pageTotal }}</span>
{% set scheme = app.request.scheme %}
{% set host = app.request.host %}
{% for i in 1..pageTotal %}
{% if currentPage == i %}
{% set cssClass = 'pageLinkCurrent' %}
{% else %}
{% set cssClass = 'pageLink' %}
{% endif %}
{% if currentPage + 5 <= i %}
{% if currentPage + 5 == i %}
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page={{ (currentPage+1) }}" class="{{ cssClass }}">></a>
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page={{ (currentPage+0) }}" class="{{ cssClass }}">>></a>
{% endif %}
{% elseif (currentPage-5) >= i %}
{% if currentPage - 5 == i %}
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page=1" class="{{ cssClass }}"><<</a>
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page={{ (currentPage-1) }}" class="{{ cssClass }}"><</a>
{% endif %}
{% else %}
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page={{ i }}" class="{{ cssClass }}">{{ i }}</a>
{% endif %}
{% endfor %}
</span>
<div class="clearPaginator">
</div>
</div>
<!-- product list -->
<div class="productContainer">
<!-- sort container -->
<div class="sortContainer">
<span class="sortTitle">{{ 'eshop.sort'|trans }}</span>
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?sort=priceASC" class="sortLink">{{ 'eshop.price_asc'|trans }}</a>
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?sort=productASC" class="sortLink">{{ 'eshop.product_name'|trans }}</a>
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?sort=default" class="sortLink">{{ 'eshop.default'|trans }}</a>
</div>
{% for product in productList %}
{% set productVAT = null %}
{% if product is defined and product.productVAT is defined and product.productVAT > 0 %}
{% set productVAT = product.productVAT %}
{% elseif eshop.preferredVAT is defined and eshop.preferredVAT > 0 %}
{% set productVAT = eshop.preferredVAT %}
{% endif %}
{% set displayPrice = null %}
{% set displayPriceVAT = null %}
{% set defaultDisplayPrice = null %}
{% set defaultDisplayPriceVAT = null %}
{% set stoneShopPrice = null %}
{% for price in productPriceList %}
{% if price.productId == product.productId %}
{# we get price level according to logged contact-customer #}
{% if app.session.get('contact') is defined
and app.session.get('contact').priceLevel is defined
and app.session.get('contact').priceLevel.priceLevelId is defined
and price is defined
and price.priceLevelId is defined
and price.priceLevelId == app.session.get('contact').priceLevel.priceLevelId %}
{# we get netto or brutto value according to e-shop configuration #}
{% if eshop.displayNettoPrices is defined and eshop.displayNettoPrices %}
{% set displayPrice = price.nettoValue|round(eshop.roundPrice, 'ceil') %}
{% else %}
{% set displayPrice = price.bruttoValue|round(eshop.roundPrice, 'ceil') %}
{% endif %}
{% if eshop.displayNettoPrices is defined and eshop.displayNettoPrices %}
{% set displayPriceVAT = displayPrice + (displayPrice * (productVAT/100)) %}
{% set displayPriceVATLabel = 'product.price_with_VAT'|trans %}
{% else %}
{% set displayPriceVAT = displayPrice - (displayPrice * (productVAT/100)) %}
{% set displayPriceVATLabel = 'product.price_without_VAT'|trans %}
{% endif %}
{% elseif price.priceLevelId == 1 %}
{# we get netto or brutto value according to e-shop configuration #}
{% if eshop.displayNettoPrices is defined and eshop.displayNettoPrices %}
{% set displayPrice = price.nettoValue|round(eshop.roundPrice, 'ceil') %}
{% else %}
{% set displayPrice = price.bruttoValue|round(eshop.roundPrice, 'ceil') %}
{% endif %}
{% if eshop.displayNettoPrices is defined and eshop.displayNettoPrices %}
{% set displayPriceVAT = displayPrice + (displayPrice * (productVAT/100)) %}
{% set displayPriceVATLabel = 'product.price_with_VAT'|trans %}
{% else %}
{% set displayPriceVAT = displayPrice - (displayPrice * (productVAT/100)) %}
{% set displayPriceVATLabel = 'product.price_without_VAT'|trans %}
{% endif %}
{% elseif price.priceLevelId > 1 %}
{% for priceLevel in priceLevelList %}
{% if price.priceLevelId == priceLevel.priceLevelId and priceLevel.priceLevelName == "stoneshop" %}
{% if eshop.displayNettoPrices is defined and eshop.displayNettoPrices %}
{% set stoneShopPrice = price.nettoValue|round(eshop.roundPrice, 'ceil') %}
{% else %}
{% set stoneShopPrice = price.bruttoValue|round(eshop.roundPrice, 'ceil') %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% set displayPackPrice = null %}
{% set displayPackPriceVAT = null %}
{% set defaultDisplayPackPrice = null %}
{% set defaultDisplayPackPriceVAT = null %}
{% if isPackSaleModule %}
{% for price in productPackPriceList %}
{% if price.productId == product.productId %}
{% if app.session.get('contact') is defined and app.session.get('contact').priceLevel is defined and price.priceLevelId == app.session.get('contact').priceLevel.priceLevelId %}
{# we get netto or brutto value according to e-shop configuration #}
{% if eshop.displayNettoPrices is defined and eshop.displayNettoPrices %}
{% set displayPackPrice = price.nettoValue|round(eshop.roundPrice, 'ceil') %}
{% else %}
{% set displayPackPrice = price.bruttoValue|round(eshop.roundPrice, 'ceil') %}
{% endif %}
{% if eshop.displayNettoPrices is defined and eshop.displayNettoPrices %}
{% set displayPackPriceVAT = displayPrice + (displayPrice * (productVAT/100)) %}
{% set displayPriceVATLabel = 'product.price_with_VAT'|trans %}
{% else %}
{% set displayPackPriceVAT = displayPrice - (displayPrice * (productVAT/100)) %}
{% set displayPriceVATLabel = 'product.price_without_VAT'|trans %}
{% endif %}
{% elseif price.priceLevelId == 1 %}
{# we get default price level#}
{% if eshop.displayNettoPrices is defined and eshop.displayNettoPrices %}
{% set displayPackPrice = price.nettoValue|round(eshop.roundPrice, 'ceil') %}
{% else %}
{% set displayPackPrice = price.bruttoValue|round(eshop.roundPrice, 'ceil') %}
{% endif %}
{% if eshop.displayNettoPrices is defined and eshop.displayNettoPrices %}
{% set displayPackPriceVAT = displayPrice + (displayPrice * (productVAT/100)) %}
{% set displayPriceVATLabel = 'product.price_with_VAT'|trans %}
{% else %}
{% set displayPackPriceVAT = displayPrice - (displayPrice * (productVAT/100)) %}
{% set displayPriceVATLabel = 'product.price_without_VAT'|trans %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
<a name="product_{{ product.productId }}"></a>
<!-- product template -->
{{ include(productTemplate) }}
{% endfor %}
</div>
<!-- navigator -->
<div class="navigator">
<span class="navigatorPath">
</span>
<span class="paginator">
{% set pageCount = productCount/countPerPage %}
<span class="smallDescription">pages {{ currentPage }}/{{ pageTotal }}</span>
{% set scheme = app.request.scheme %}
{% set host = app.request.host %}
{% for i in 1..pageTotal %}
{% if currentPage == i %}
{% set cssClass = 'pageLinkCurrent' %}
{% else %}
{% set cssClass = 'pageLink' %}
{% endif %}
{% if currentPage + 5 <= i %}
{% if currentPage + 5 == i %}
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page={{ (currentPage+1) }}" class="{{ cssClass }}">></a>
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page={{ (currentPage+0) }}" class="{{ cssClass }}">>></a>
{% endif %}
{% elseif (currentPage-5) >= i %}
{% if currentPage - 5 == i %}
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page=1" class="{{ cssClass }}"><<</a>
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page={{ (currentPage-1) }}" class="{{ cssClass }}"><</a>
{% endif %}
{% else %}
<a href="{{ scheme }}://{{ host }}{{ app.request.pathinfo }}?page={{ i }}" class="{{ cssClass }}">{{ i }}</a>
{% endif %}
{% endfor %}
</span>
<div class="clearPaginator">
</div>
</div>
{% endblock %}