Guest User

Code swatch

a guest
May 27th, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.40 KB | None | 0 0
  1. {%- if option_type == 'image' %}
  2.                               <div class="grid-x">
  3.                                 {%- assign color = '' -%}
  4.                                 {%- assign shown_list = '' -%}
  5.                                 {%- for variant in product.variants -%}
  6.                                   {%- assign option_handle = variant.options[option_index] -%}
  7.                                   {%- unless shown_list contains option_handle -%}
  8.                                     {%- if variant.image -%}
  9.                                       <label class="product-option-value-item product-option-image">
  10.                                         <input type="radio" name="option{{ option.position }}" {% if variant == current_variant %}checked="checked"{% endif %} value="{{ option_handle | escape }}" data-product-option="{{ option_index }}" />
  11.                                         <img src="{{ 'icon-loader-clock.svg' | asset_url }}" data-src="{{ variant.image | img_url: thumb_height }}" class="display-block lazyload" alt="{{ option_handle }}"/>
  12.                                       </label>
  13.                                     {%- endif -%}
  14.                                     {%- assign shown_list = shown_list | join: ',' -%}
  15.                                     {%- assign shown_list = shown_list | append: ',' | append: option_handle -%}
  16.                                     {%- assign shown_list = shown_list | split: ',' -%}
  17.                                   {%- endunless -%}
  18.                                 {%- endfor -%}
  19.                               </div>
  20.                             {%- elsif option_type == 'color' %}
  21.                               <div class="grid-x">
  22.                                 {%- assign color = '' -%}
  23.                                 {%- assign shown_list = '' -%}
  24.                                 {%- for variant in product.variants -%}
  25.                                   {%- assign option_handle = variant.options[option_index] -%}
  26.                                   {%- unless shown_list contains option_handle -%}
  27.                                       {%- capture color_code -%}
  28.                                         {%- include 'product-option-color-detector' -%}
  29.                                       {%- endcapture -%}
  30.                                       {%- assign color_code = color_code | strip | strip_newlines -%}
  31.                                       {%- if color_code != blank -%}
  32.                                         <label class="product-option-value-item product-option-color">
  33.                                           <input type="radio" name="option{{ option.position }}" {% if variant == current_variant %}checked="checked"{% endif %} value="{{ option_handle | escape }}" data-product-option="{{ option_index }}" />
  34.                                           <span class="display-block" style="background: {{ color_code }};"></span>
  35.                                         </label>
  36.                                       {%- endif -%}
  37.                                     {%- assign shown_list = shown_list | join: ',' -%}
  38.                                     {%- assign shown_list = shown_list | append: ',' | append: option_handle -%}
  39.                                     {%- assign shown_list = shown_list | split: ',' -%}
  40.                                   {%- endunless -%}
  41.                                 {%- endfor -%}
  42.                               </div>
Advertisement
Add Comment
Please, Sign In to add comment