{%- comment -%} Renders a media element for the product gallery. Media types include: image, video, external_video and model. Accepts: - media: {Object} Media Liquid object (required) - featured_media: {Object} Media Liquid object (required) - featured media of a given product or variant Usage: {%- for media in product.media -%} {% render 'media', media: media, featured_media: featured_media %} {%- endfor -%} {%- endcomment -%} {%- assign image_size = '1024x1024' -%} {%- assign image_zoom_size = '2048x2048' -%} {%- capture media_wrapper_id -%}FeaturedMedia-{{ unique }}-{{ media.id }}-wrapper{%- endcapture -%} {%- assign media_aspect_ratio = media.aspect_ratio -%} {%- unless media_aspect_ratio -%} {%- assign media_aspect_ratio = 1 -%} {%- endunless -%} {%- assign media_padding_top = 1 | divided_by: media_aspect_ratio | times: 100 | round: 1 -%} {%- comment -%} Always show product media in square on Quick view {%- endcomment -%} {%- if template == 'product.ajax_quickview' -%} {%- assign media_padding_top = 100 -%} {%- endif -%} {%- capture sale_badge -%} {%- if show_sale_badge and featured_media == media -%} {%- if current_variant.compare_at_price > current_variant.price -%} {%- if sold_out -%} {%- assign on_sale = false -%} {%- else -%} {%- assign on_sale = true -%} {%- endif -%} {%- else -%} {%- assign on_sale = false -%} {%- endif -%} {%- if on_sale -%}
{{ 'products.product.on_sale_html' | t }}
{%- endif -%} {%- endif -%} {%- endcapture -%} {%- assign sold_out = true -%} {%- if current_variant.available -%} {%- assign sold_out = false -%} {%- endif -%} {%- assign image_gallery_class = '' -%} {%- if image_gallery == 'zoom' -%} {%- assign image_gallery_class = 'hover-zoom' -%} {%- elsif image_gallery == 'lightbox' -%} {%- assign image_gallery_class = 'mfp-zoom-in-cur' -%} {%- endif -%} {% assign color_label = 'color,colour,couleur,colore,farbe,색,色,färg,farve' | split: ',' %} {% assign alt_down = media.alt | downcase %} {% assign is_color = false %} {% assign type_color = false %} {%- for option in product.options_with_values -%} {%- assign downcased_option = option.name | downcase -%} {% if color_label contains downcased_option %} {% assign is_color = true %} {% assign select_Value = option.selected_value | downcase %} {% for value in option.values %} {% assign value_down = value | downcase %} {% comment %} {{ value_down }} -- {{ alt_down}} {% endcomment %} {% if value_down == alt_down %} {% assign type_color = true %} {% endif %} {% endfor %} {% endif %} {% endfor %} {% comment %} find theme.js [change_tab_image] to custom function {% endcomment %}