{% block sync4_content_visual_order %}
{% set absoluteBaseUrl = app.request.attributes.get('sw-sales-channel-absolute-base-url') %}
{% set baseUrl = app.request.attributes.get('sw-sales-channel-base-url') %}
{% set fullUrl = absoluteBaseUrl ~ baseUrl %}
<div class="visual-order is-{{ config('Sync4ApiExport.config.visualOrderLayout') }}">
{% set visualOrder = context.context.extensions.Sync4ApiExport.visualOrder %}
{% set explosionimages = visualOrder.explosionimages %}
{% for element in explosionimages %}
<div class="visual-order-element{% if visualOrder.hover is same as (true) %} is-hover{% endif %}">
{% block sync4_content_visual_order_styles %}
<style>
{% for marker in element.markings %}
#marker-{{ marker.id }} {
top: {{ marker.top ~'%' }};
left: {{ marker.left ~'%' }};
height: {{ marker.height ~'%' }};
width: {{ marker.width ~'%' }};
}
{% endfor %}
</style>
{% endblock %}
{% block sync4_content_visual_order_image %}
<div class="visual-order-image">
{% set mediaId = element.source %}
{% set mediaCollection = searchMedia([mediaId], context.context) %}
{% set media = mediaCollection.get(mediaId) %}
{% sw_thumbnails 'my-thumbnails' with {
media: media,
attributes: {
'title': "#{element.imagename}",
'alt': "#{element.imagename}"
}
} %}
</div>
{% endblock %}
{% block sync4_content_visual_order_mapping %}
<div class="visual-order-mapping">
<ul class="mapping-list">
{% for marker in element.markings %}
<li id="marker-{{ marker.id }}" class="marker">
{% if marker.type is same as ('Category') %}
{% set url = fullUrl ~ '/navigation/' ~ marker.link|join %}
{% elseif marker.type is same as ('Product') %}
{% if marker.link|length > 1 %}
{% set url = fullUrl ~ '/search?search=' ~ marker.link|join(',') %}
{% else %}
{% set url = seoUrl('frontend.detail.page', { 'productId': marker.link|join }) %}
{% endif %}
{% elseif marker.type is same as ('Url') %}
{% if marker.link|join starts with 'http' %}
{% set target = '_blank' %}
{% set url = marker.link|join %}
{% else %}
{% set url = fullUrl ~ marker.link|join %}
{% endif %}
{% endif %}
<a href="{{ url }}" class="marker-link"{% if target %} target="{{ target }}"{% endif %}></a>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
</div>
{% endfor %}
</div>
{% endblock %}