Größentabelle
{% assign apple_watch_bandbreite = product.metafields.custom.bandbreite_apple_watch %}
{% assign apple_watch_schliessenbreite = product.metafields.custom.schliessenbreite_apple_watch %}
{% assign apple_watch_bandlaenge = product.metafields.custom.bandlaenge %}
{% assign ultra_bandbreite = product.metafields.custom.bandbreite_apple_watch_ultra %}
{% assign ultra_schliessenbreite = product.metafields.custom.schliessenbreite_apple_watch_ultra %}
{% assign ultra_bandlaenge = product.metafields.custom.bandlaenge %}
{% assign show_apple_watch = false %}
{% assign show_ultra = false %}
{% if apple_watch_bandbreite or apple_watch_schliessenbreite %}
{% assign show_apple_watch = true %}
{% endif %}
{% if ultra_bandbreite or ultra_schliessenbreite %}
{% assign show_ultra = true %}
{% endif %}
{% if show_apple_watch or show_ultra %}
|
{% if show_apple_watch %}
Apple Watch |
{% endif %}
{% if show_ultra %}
Apple Watch Ultra (2) |
{% endif %}
Bandbreite |
{% if show_apple_watch %}
{{ apple_watch_bandbreite }} mm |
{% endif %}
{% if show_ultra %}
{{ ultra_bandbreite }} mm |
{% endif %}
Schließenbreite |
{% if show_apple_watch %}
{{ apple_watch_schliessenbreite }} mm |
{% endif %}
{% if show_ultra %}
{{ ultra_schliessenbreite }} mm |
{% endif %}
Bandlänge |
{% if show_apple_watch %}
{{ apple_watch_bandlaenge }} mm |
{% endif %}
{% if show_ultra %}
{{ ultra_bandlaenge }} mm |
{% endif %}
Handgelenksumfang |
{% if show_apple_watch %}
{% if apple_watch_bandlaenge contains "-" %}
{% assign apple_watch_bandlaenge_split = apple_watch_bandlaenge | split: "-" %}
{% assign apple_watch_umfang_start = apple_watch_bandlaenge_split[0] | plus: 45 %}
{% assign apple_watch_umfang_end = apple_watch_bandlaenge_split[1] | plus: 45 %}
{{ apple_watch_umfang_start }}-{{ apple_watch_umfang_end }} mm |
{% else %}
N/A |
{% endif %}
{% endif %}
{% if show_ultra %}
{% if ultra_bandlaenge contains "-" %}
{% assign ultra_bandlaenge_split = ultra_bandlaenge | split: "-" %}
{% assign ultra_umfang_start = ultra_bandlaenge_split[0] | plus: 49 %}
{% assign ultra_umfang_end = ultra_bandlaenge_split[1] | plus: 49 %}
{{ ultra_umfang_start }}-{{ ultra_umfang_end }} mm |
{% else %}
N/A |
{% endif %}
{% endif %}
{% assign apple_watch_size = "" %}
{% if apple_watch_umfang_start and apple_watch_umfang_end %}
{% assign ranges = "S/M:140-190,M/L:160-210,XL:195-245" | split: "," %}
{% assign max_overlap = 0 %}
{% assign best_size = "" %}
{% for range in ranges %}
{% assign size = range | split: ":" %}
{% assign label = size[0] %}
{% assign span = size[1] | split: "-" %}
{% assign span_start = span[0] | plus: 0 %}
{% assign span_end = span[1] | plus: 0 %}
{% assign overlap_start = apple_watch_umfang_start | at_least: span_start %}
{% assign overlap_end = apple_watch_umfang_end | at_most: span_end %}
{% assign overlap = overlap_end | minus: overlap_start %}
{% if overlap > max_overlap %}
{% assign max_overlap = overlap %}
{% assign best_size = label %}
{% endif %}
{% endfor %}
{% assign apple_watch_size = best_size %}
{% endif %}
{% assign ultra_size = "" %}
{% if ultra_umfang_start and ultra_umfang_end %}
{% assign ranges = "S/M:140-190,M/L:160-210,XL:195-245" | split: "," %}
{% assign max_overlap = 0 %}
{% assign best_size = "" %}
{% for range in ranges %}
{% assign size = range | split: ":" %}
{% assign label = size[0] %}
{% assign span = size[1] | split: "-" %}
{% assign span_start = span[0] | plus: 0 %}
{% assign span_end = span[1] | plus: 0 %}
{% assign overlap_start = ultra_umfang_start | at_least: span_start %}
{% assign overlap_end = ultra_umfang_end | at_most: span_end %}
{% assign overlap = overlap_end | minus: overlap_start %}
{% if overlap > max_overlap %}
{% assign max_overlap = overlap %}
{% assign best_size = label %}
{% endif %}
{% endfor %}
{% assign ultra_size = best_size %}
{% endif %}
{% assign final_size = apple_watch_size %}
{% if ultra_size != "" and apple_watch_size == "" %}
{% assign final_size = ultra_size %}
{% endif %}
{% if final_size != "" %}
Vergleichbar bei Apple mit Größe
{{ final_size }}
{% endif %}
{% endif %}