From 8d037b81891b95f5410e8ffd9b0f3507051a3924 Mon Sep 17 00:00:00 2001 From: Jan Umbach Date: Wed, 29 May 2024 20:50:29 +0200 Subject: [PATCH] equaled featured_media and normal pictures to keep picture sorted --- snippets/product-media-gallery.liquid | 98 +++++++++------------------ 1 file changed, 31 insertions(+), 67 deletions(-) diff --git a/snippets/product-media-gallery.liquid b/snippets/product-media-gallery.liquid index 35b9376..4912abd 100644 --- a/snippets/product-media-gallery.liquid +++ b/snippets/product-media-gallery.liquid @@ -217,93 +217,57 @@ calc((100vw - 8rem) / 3) {%- endcapture -%} {%- for media in product.media -%} - {%- unless media.id == product.selected_or_first_available_variant.featured_media.id -%} - {%- liquid - capture media_index - if media.media_type == 'model' - increment model_index - elsif media.media_type == 'video' or media.media_type == 'external_video' - increment video_index - elsif media.media_type == 'image' - increment image_index - endif - endcapture - assign media_index = media_index | plus: 1 - -%} - - {%- endunless -%} - {%- endfor -%} - {%- if featured_media != null -%} {%- liquid capture media_index - if featured_media.media_type == 'model' + if media.media_type == 'model' increment model_index - elsif featured_media.media_type == 'video' or featured_media.media_type == 'external_video' + elsif media.media_type == 'video' or media.media_type == 'external_video' increment video_index - elsif featured_media.media_type == 'image' + elsif media.media_type == 'image' increment image_index endif endcapture assign media_index = media_index | plus: 1 -%} - {%- endif -%} + {%- endfor -%}