Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
6.5 kB
1
Indexable
Never
{%- assign selected_variant = product.selected_or_first_available_variant -%}

{%- if block.settings.show_share_buttons -%}
  {%- capture share_buttons -%}
    {%- assign share_url = shop.url | append: product.url | url_param_escape -%}
    {%- assign twitter_text = product.title | url_param_escape -%}
    {%- assign pinterest_description = product.description | strip_html | truncatewords: 15 | url_param_escape -%}
    {%- assign pinterest_image = product.featured_media | img_url: '1024x' | prepend: 'https:' -%}

    <ul class="social-media__item-list list--unstyled" role="list">
      <li class="social-media__item social-media__item--facebook">
        <a href="https://www.facebook.com/sharer.php?u={{ share_url }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.facebook_share' | t }}">{%- render 'icon', icon: 'facebook' -%}</a>
      </li>

      <li class="social-media__item social-media__item--pinterest">
        <a href="https://pinterest.com/pin/create/button/?url={{ share_url }}{% if pinterest_image != blank %}&media={{ pinterest_image }}{% endif %}&description={{ pinterest_description }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.pinterest_pin' | t }}">{%- render 'icon', icon: 'pinterest' -%}</a>
      </li>

      <li class="social-media__item social-media__item--twitter">
        <a href="https://twitter.com/share?{% if twitter_text != blank %}text={{twitter_text}}&{% endif %}url={{ share_url }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.twitter_tweet' | t }}">{%- render 'icon', icon: 'twitter' -%}</a>
      </li>

      <li class="social-media__item">
        <a href="mailto:?&subject={{ product.title | escape }}&body={{ share_url }}" aria-label="{{ 'general.social.email_share' | t }}">{% render 'icon', icon: 'email' %}</a>
      </li>
    </ul>
  {%- endcapture -%}
{%- endif -%}

<div class="product-meta">
  {%- if template.name == 'product' and template != 'product.quick-view' -%}
    <h1 class="product-meta__title heading h1">{{ product.title }}</h1>
  {%- else -%}
    <h3 class="product-meta__title heading h2">
      <a href="{{ product.url }}">{{ product.title }}</a>
    </h3>
  {%- endif -%}


  
  {%- capture product_labels -%}
    {%- for tag in product.tags -%}
      {%- if tag contains '__label:' -%}
        <span class="product-label product-label--custom1">{{ tag | split: '__label:' | last }}</span>
      {%- endif -%}

      {%- if tag contains '__label1:' -%}
        <span class="product-label product-label--custom1">{{ tag | split: '__label1:' | last }}</span>
      {%- endif -%}

      {%- if tag contains '__label2:' -%}
        <span class="product-label product-label--custom2">{{ tag | split: '__label2:' | last }}</span>
      {%- endif -%}
    {%- endfor -%}

    {%- if settings.show_discount -%}
      {%- assign savings = 0 -%}

      {%- if settings.discount_mode == 'percentage' -%}
        {%- assign savings = selected_variant.compare_at_price | minus: selected_variant.price | times: 100.0 | divided_by: selected_variant.compare_at_price | round | append: '%' -%}
      {%- else -%}
        {%- capture savings -%}<span>{{ selected_variant.compare_at_price | minus: selected_variant.price | money }}</span>{%- endcapture -%}
      {%- endif -%}

      <span class="product-label product-label--on-sale" {% unless selected_variant.price < selected_variant.compare_at_price %}style="display: none"{% endunless %}>{{ 'collection.product.discount_html' | t: savings: savings }}</span>
    {%- endif -%}
  {%- endcapture -%}

  {%- if product_labels != blank -%}
    <div class="product-meta__label-list">
      {{- product_labels -}}
    </div>
  {%- endif -%}

  {%- if block.settings.show_vendor or block.settings.show_sku -%}
    <div class="product-meta__reference">
      {%- if block.settings.show_vendor -%}
        {%- assign vendor_handle = product.vendor | handle -%}
        {%- assign collection_for_vendor = collections[vendor_handle] -%}

        {%- unless collection_for_vendor.empty? -%}
          <a class="product-meta__vendor link link--accented" href="{{ collection_for_vendor.url }}">{{ product.vendor }}</a>
        {%- else -%}
          <a class="product-meta__vendor link link--accented" href="{{ product.vendor | url_for_vendor }}">{{ product.vendor }}</a>
        {%- endunless -%}
      {%- endif -%}

      {%- if block.settings.show_sku -%}
        <span class="product-meta__sku" {% if selected_variant.sku == blank %}style="display: none"{% endif %}>
          {{- 'product.general.sku' | t -}} <span class="product-meta__sku-number">{{ selected_variant.sku }}</span>
        </span>
      {%- endif -%}
    </div>
  {%- endif -%}

<!--   {%- if block.settings.show_reviews_badge -%}
    <a href="{% if template.name != 'product' or template == 'product.quick-view' %}{{ product.url }}{% endif %}#product-reviews" class="product-meta__reviews-badge link" data-offset="30">
      <a href="/pages/happy-customers">
{% if shop.metafields.loox["global_stats"] %}
{% assign looxstats = shop.metafields.loox["global_stats"] | split: ',' %} 
<div class="loox-rating loox-rating-hp" data-rating="{{ looxstats[0] }}" data-raters="{{ looxstats[1] }}"></div> 
{% endif %}</a>

    </a>
  {%- endif -%} -->
  
   {%- if block.settings.show_reviews_badge -%}
    <a href="{% if template.name != 'product' or template == 'product.quick-view' %}{{ product.url }}{% endif %}#product-reviews" class="product-meta__reviews-badge link" data-offset="30">
      <a href="/pages/happy-customers">
{% assign loox_tag = product.tags | where: "lx-" | first %}
{% if shop.metafields.loox["tags_stats"][loox_tag].avg %}
 <a href="#looxReviews"><div class="loox-rating" data-id="{{ product.id }}" data-rating="{{ shop.metafields.loox["tags_stats"][loox_tag].avg }}" data-raters="{{ shop.metafields.loox["tags_stats"][loox_tag].num }}"></div></a>
{% else %}
<a href="#looxReviews"><div class="loox-rating" data-id="{{ product.id }}" data-rating="{{ product.metafields.loox.avg_rating }}" data-raters="{{ product.metafields.loox.num_reviews }}"></div></a>
{% endif %}
    </a>
  {%- endif -%}

  {%- if block.settings.show_share_buttons -%}
    <div class="product-meta__share-buttons hidden-phone">
      {{ share_buttons }}
    </div>
  {%- endif -%}
</div>

<hr class="card__separator">