{% set variantNotAvailable = variant.salesStatus is defined and
variant.salesStatus == constant('App\\Constant\\SalesStatus::SALE_STATUS_TEMPORARY_NOT_AVAILABLE') %}
{% if product.variants | length > 1 or variant.variantSelections|default([])|length > 1 %}
<div class="variant-selection" >
{% block buyBoxVariants %}
{% if isPunchout %}
{% if product.variants | length > 1 %}
{% set currentVariantSku = variant.sku %}
{% embed 'components/atoms/select/select.html.twig'
with {
'class': 'js-auto-route js-page-loader-change',
'id': 'punchoutVariantSelection',
'name': 'punchoutVariantSelection',
'options': product.variants,
} %}
{% block options %}
{% for variant in product.variants %}
{% if variant.salesStatus == "saleable" and variant.attributes.price is not empty and variant.attributes.price != 0 %}
<option
value="{{ variant.links.webshop }}"
{% if variant.sku == currentVariantSku %}
selected="selected"
{% endif %}
>
{{ variant.variantSelections| first }}
</option>
{% endif %}
{% endfor %}
{% endblock %}
{% endembed %}
{% endif %}
{% else %}
{% if variant.variantSelections|default %}
{% for variantSelection in variant.variantSelections %}
{% if variantSelection.type is defined and variantSelection.type == 'tile' %}
<div class="variant-selection__color">
<p class="variant-selection__color-text">
{{ variantSelection.label|default('product_select_color'|trans) }}: {{ (variantSelection.options|filter(o => o.selected == true)|first).name }}
</p>
<div class="variant-selection__variant variant-selection__variant--color">
{% set sortedOptions = variantSelection.options|sort((a, b) => a.name <=> b.name) %}
{% for key, option in sortedOptions %}
{% include 'components/atoms/color-input/color-input.html.twig' with {
'selected': option.selected,
'name': option.name,
'href': option.value,
'hex': ('variant_selection_color_' ~ option.key)|trans
} %}
{% endfor %}
</div>
</div>
{% endif %}
{% if variantSelection.type is defined and variantSelection.type == 'select' %}
<div class="variant-selection__variant">
<div class="form-row form-row--floating">
{% embed 'components/atoms/select/select.html.twig'
with {
'class': 'js-auto-route js-page-loader-change',
'id': variantSelection.name|default,
'name': variantSelection.name|default,
'options': variantSelection.options,
} %}
{% block options %}
{% for option in variantSelection.options %}
<option
value="{{ option.value }}"
{% if option.selected %}selected{% endif %}
{% if not option.saleable or not option.sameAttributeSet %}
class="gray"
{% if not option.saleable %}
title="{{ 'buy_box_variant_not_available'|trans }}"
{% else %}
title="{{ 'buy_box_variant_not_same_attribute_set'|trans }}"
{% endif %}
{% endif %}
>
{{ option.name }}
</option>
{% endfor %}
{% endblock %}
{% endembed %}
<label for="{{ variantSelection.name }}" class="form-row__label" data-content="{{ variantSelection.label|default|prepare_for_css_content_attribute }}">
<span class="form-row__hidden-visually">{{ variantSelection.label|default }}</span>
</label>
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endblock %}
{% block buyBoxOptions %}
{% if product.productOptions|default %}
{% include 'components/atoms/button/button.html.twig' with {
'type': 'button',
'class': 'button--select js-offside',
'content': 'buy_box_select_option'|trans,
'attributes': {
'data-offside-component': 'productOptions',
'data-offside-sliding-side': 'right'
}
} %}
{% embed 'components/organisms/offside/offside.html.twig' with {
'id': 'productOptions',
'header': 'buy_box_select_option'|trans
} %}
{% block content %}
{% block offcanvasContent %}
{% for productOption in product.productOptions %}
<p>{{ productOption.name }}</p>
{% endfor %}
{% endblock %}
{% endblock %}
{% endembed %}
{% endif %}
{% endblock %}
</div>
{% endif %}