{% sw_extends '@Storefront/storefront/page/product-detail/description.html.twig' %}
{% block page_product_detail_description_title %}
<h2 class="product-detail-description-title text-uppercase">
{% if page.product.manufacturer %}
{{ page.product.manufacturer.translated.name}}
{% endif %}
{{ page.product.translated.name }}
{%- if page.product.options is defined -%}
{% set optionStrings = [] %} {% set seperatorBetweenOptions = ' ' %}
{%- for option in page.product.options -%}
{%- set singleOption = [option.name] -%}
{%- set optionStrings = optionStrings|merge(singleOption) -%}
{%- endfor -%} {{- optionStrings|join(seperatorBetweenOptions) -}}
{%- endif -%}
</h2>
{% endblock %}
{% block page_product_detail_description_content_text %}
{% set image_path="/bundles/traumplugin/img/quality_seal/" %}
{% set customFields = page.product.translated.customFields %}
{% set quality_seals = customFields.custom_traum_default_quality_seal %}
{% set pdfMediaIds = [] %}
{% set pdfLabels = [] %}
{{ parent() }}
{# Performance Issue#}
{% if customFields.custom_traum_default_pdf_file %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name }) %}
{% endif %}
{# Show Intro-Text, Snippet must be added manualy through backend #}
<hr />
{{ 'custom_traum_default_pdf_file_hint'|trans|raw }}
{% endif %}
{% if customFields.custom_traum_default_pdf_file1 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file1 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name1 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name1 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file2 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file2 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name2 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name2 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file3 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file3 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name3 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name3 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file4 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file4 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name4 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name4 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file5 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file5 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name5 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name5 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file6 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file6 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name6 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name6 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file7 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file7 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name7 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name7 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file8 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file8 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name8 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name8 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file9 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file9 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name9 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name9 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file10 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file10 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name10 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name10 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file11 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file11 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name11 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name11 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file12 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file12 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name12 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name12 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file13 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file13 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name13 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name13 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file14 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file14 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name14 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name14 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file15 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file15 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name15 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name15 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file16 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file16 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name16 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name16 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file17 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file17 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name17 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name17 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file18 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file18 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name18 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name18 }) %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_pdf_file19 %}
{% set pdfMediaId = customFields.custom_traum_default_pdf_file19 %}
{% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}
{% if customFields.custom_traum_default_pdf_file_name19 %}
{% set pdfLabels = pdfLabels|merge({ (pdfMediaId): customFields.custom_traum_default_pdf_file_name19 }) %}
{% endif %}
{% endif %}
{# {% for i in 1..19 %}#}
{# {i}, Loop does not work!
{# {% if customFields.custom_traum_default_pdf_file~{{ i }} %}#}
{# {% set pdfMediaId = customFields.custom_traum_default_pdf_file~{{ i }} %}#}
{# {% set pdfMediaIds = pdfMediaIds|merge([pdfMediaId]) %}#}
{# {% endif %}#}
{# {% endfor %}#}
{# {{ dump(pdfLabels) }}#}
{% if customFields.custom_traum_default_pdf_file %}
{% set mediaCollection = searchMedia(pdfMediaIds, context.context) %}
{% if mediaCollection %}
{% for pdfEntity in mediaCollection %}
<p><a class="btn btn-secondary btn-sm" rel="noopener" href="{{pdfEntity.url}}" target="_blank">
{% if pdfLabels[pdfEntity.id] %}
{{ pdfLabels[pdfEntity.id] }}
{% else %}
{{ pdfEntity.fileName }}
{% endif %}
</a></p>
{% endfor %}
{% endif %}
{% endif %}
{% if customFields.custom_traum_default_show_sofa_hint %}
{# Show sofa hint #}
{{ 'customFields.custom_traum_default_show_sofa_hint'|trans|raw }}
{% endif %}
<hr/>
{% if customFields.custom_traum_default_tab_title %}
<div class="h3"> {{ customFields.custom_traum_default_tab_title }}</div>
{% endif %}
{% if customFields.custom_traum_default_tab_content %}
<div class="product-detail-description-text">
{{ customFields.custom_traum_default_tab_content |raw }}
</div>
{% endif %}
{% if quality_seals|length > 0 %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title text-uppercase">
{# Snippet must be added manualy through backend#}
{{ "traum_quality_seal" |trans }}
</h4>
</div>
<div class="panel-body">
{% for quality_seal in quality_seals %}
<img src="{{ image_path ~ quality_seal }}.jpg" alt="logo_{{ quality_seal }}" />
{% endfor %}
</div>
</div>
{% endif %}
{% endblock %}
{% block page_product_detail_description_content_properties %} {% endblock %}