121 lines
6.9 KiB
Plaintext
121 lines
6.9 KiB
Plaintext
{% assign hideOtherLabelsWhenSoldOut = true -%}
|
|
{% assign money_format = request.money_format | strip_html -%}
|
|
{% assign removePriceDecimal = false -%}
|
|
{% assign showCentAsSuperscript = false -%}
|
|
{% assign decimalDelimiter = '' -%}
|
|
{% assign withoutTrailingZeros = true -%}
|
|
|
|
{% assign compareAtPriceMin = product.compare_at_price_min | default: 0 -%}
|
|
{% assign priceMin = product.price_min | default: 0 %}
|
|
|
|
{% assign yagi_discount_percentage = product | product_metafield: 'yagi.discount_percentage' | plus: 0 %}
|
|
{% if yagi_discount_percentage > 0.01 %}
|
|
{% assign compareAtPriceMin = priceMin %}
|
|
|
|
{% assign deducted_percentage = 1.0 | minus: yagi_discount_percentage %}
|
|
{% assign priceMin = priceMin | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil %}
|
|
{% endif %}
|
|
|
|
{% if hideOtherLabelsWhenSoldOut != true -%}
|
|
{% settings if themeSettings.productItems.productImg.elements.productSaleLabel.isEnable %}
|
|
{% if compareAtPriceMin > priceMin -%}
|
|
{% assign percent = compareAtPriceMin | minus: priceMin | times: 100 | divided_by: compareAtPriceMin | round -%}
|
|
|
|
{% if yagi_discount_percentage > 0.01 %}
|
|
{% assign percent = yagi_discount_percentage | times: 100 | ceil %}
|
|
{% endif %}
|
|
{% assign salePercent = percent | append: '%' -%}
|
|
{% assign saleAmount = compareAtPriceMin | minus: priceMin | format_currency: money_format, showCentAsSuperscript, removePriceDecimal, decimalDelimiter, withoutTrailingZeros -%}
|
|
{% assign productItemSaleTranslated = "productItem.productItemSale" | translate: translations, "Sale" | replace: '{{salePercent}}', salePercent | replace: '{{saleAmount}}', saleAmount -%}
|
|
<div class="boost-sd__product-label boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productSaleLabel.displayType }} boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productSaleLabel.shape }} boost-sd__product-label--sale">
|
|
<span class="boost-sd__product-label-text">
|
|
<span>{{ productItemSaleTranslated }}</span>
|
|
</span>
|
|
</div>
|
|
{% endif -%}
|
|
{% settings endif %}
|
|
|
|
{% settings if themeSettings.productItems.productImg.elements.productSoldOutLabel.isEnable %}
|
|
{% if product.available == false -%}
|
|
<div class="boost-sd__product-label boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productSoldOutLabel.displayType }} boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productSoldOutLabel.shape }} boost-sd__product-label--soldout">
|
|
<span class="boost-sd__product-label-text">{{ "productItem.productItemSoldOut" | translate: translations, "Sold out" }}</span>
|
|
</div>
|
|
{% endif -%}
|
|
{% settings endif %}
|
|
|
|
{% settings if themeSettings.productItems.productImg.elements.productCustomLabelByTag.isEnable %}
|
|
{% assign filtered_tags = "" -%}
|
|
{% assign all_tags = product.tags -%}
|
|
{% if product.original_tags != nill %}
|
|
{% assign all_tags = all_tags | concat: product.original_tags -%}
|
|
{% endif %}
|
|
{% for tag in all_tags -%}
|
|
{% if tag contains 'pfs:label' -%}
|
|
{% assign tag_without_label = tag | remove: 'pfs:label-' -%}
|
|
{% assign filtered_tags = filtered_tags | append: tag_without_label | append: ',' -%}
|
|
{% endif -%}
|
|
{% endfor -%}
|
|
{% assign filtered_tags = filtered_tags | split: ',' -%}
|
|
|
|
{% for tag in filtered_tags -%}
|
|
{% unless tag == blank %}
|
|
<div class="boost-sd__product-label boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productCustomLabelByTag.shape }} boost-sd__product-label--custom-label-by-tag">
|
|
<span class="boost-sd__product-label-text">
|
|
<span>{{ tag }}</span>
|
|
</span>
|
|
</div>
|
|
{% endunless %}
|
|
{% endfor -%}
|
|
{% settings endif %}
|
|
{% else -%}
|
|
{% if product.available == false -%}
|
|
{% settings if themeSettings.productItems.productImg.elements.productSoldOutLabel.isEnable %}
|
|
<div class="boost-sd__product-label boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productSoldOutLabel.displayType }} boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productSoldOutLabel.shape }} boost-sd__product-label--soldout">
|
|
<span class="boost-sd__product-label-text">{{ "productItem.productItemSoldOut" | translate: translations, "Sold out" }}</span>
|
|
</div>
|
|
{% settings endif %}
|
|
{% else -%}
|
|
{% settings if themeSettings.productItems.productImg.elements.productSaleLabel.isEnable %}
|
|
{% if compareAtPriceMin > priceMin -%}
|
|
{% assign percent = compareAtPriceMin | minus: priceMin | times: 100 | divided_by: compareAtPriceMin| round -%}
|
|
{% if yagi_discount_percentage > 0.01 %}
|
|
{% assign percent = yagi_discount_percentage | times: 100 | ceil %}
|
|
{% endif %}
|
|
{% assign salePercent = percent | append: '%' -%}
|
|
{% assign saleAmount = compareAtPriceMin | minus: priceMin | format_currency: money_format, showCentAsSuperscript, removePriceDecimal, decimalDelimiter, withoutTrailingZeros -%}
|
|
{% assign translatedText = "productItem.productItemSale" | translate: translations, "Sale" | replace: '{{salePercent}}', salePercent | replace: '{{saleAmount}}', saleAmount %}
|
|
<div class="boost-sd__product-label boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productSaleLabel.displayType }} boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productSaleLabel.shape }} boost-sd__product-label--sale">
|
|
<span class="boost-sd__product-label-text">
|
|
<span>{{ translatedText }}</span>
|
|
</span>
|
|
</div>
|
|
{% endif -%}
|
|
{% settings endif %}
|
|
|
|
{% settings if themeSettings.productItems.productImg.elements.productCustomLabelByTag.isEnable %}
|
|
{% assign filtered_tags = "" -%}
|
|
{% assign all_tags = product.tags -%}
|
|
{% if product.original_tags != nill %}
|
|
{% assign all_tags = all_tags | concat: product.original_tags -%}
|
|
{% endif %}
|
|
{% for tag in all_tags -%}
|
|
{% if tag contains 'pfs:label' -%}
|
|
{% assign tag_without_label = tag | remove: 'pfs:label-' -%}
|
|
{% assign filtered_tags = filtered_tags | append: tag_without_label | append: ',' -%}
|
|
{% endif -%}
|
|
{% endfor -%}
|
|
{% assign filtered_tags = filtered_tags | split: ',' -%}
|
|
|
|
{% for tag in filtered_tags -%}
|
|
{% unless tag == blank %}
|
|
<div class="boost-sd__product-label boost-sd__product-label--{{ settings themeSettings.productItems.productImg.elements.productCustomLabelByTag.shape }} boost-sd__product-label--custom-label-by-tag">
|
|
<span class="boost-sd__product-label-text">
|
|
<span>{{ tag }}</span>
|
|
</span>
|
|
</div>
|
|
{% endunless %}
|
|
{% endfor -%}
|
|
{% settings endif %}
|
|
{% endif -%}
|
|
{% endif -%}
|