{# ThemeWare "Product badges" container #} {# Create container and include badges #} {# INFO: Inheritance changed in SW6.4 so this file must to have the full code and can't be extended. #} {# {% sw_extends '@Storefront/storefront/component/product/card/badges.html.twig' %} #} {# ---------------- START: SET TEMPLATE VARS ---------------- #} {# ThemeWare: Set theme variables #} {% set twtProductBadgesDiscountBadgeType = theme_config('twt-product-badges-discount-badge-type') %} {% set twtProductBadgesShippingFreeBadgeShow = theme_config('twt-product-badges-shipping-free-badge-show') %} {% set twtProductBadgesSoldBadgeShow = theme_config('twt-product-badges-sold-badge-show') %} {% set twtProductBadgesStockBadgeShow = theme_config('twt-product-badges-stock-badge-show') %} {# ---------------- END: SET TEMPLATE VARS ---------------- #} {% block component_product_badges %}
{# ThemeWare: Adjustments on the product discount badge #} {% block component_product_badges_discount %} {# ThemeWare: Add TWT shipping free badge #} {# TODO: Hide default shipping-free hint #} {# ThemeWare: Add TWT sold badge #} {% if twtProductBadgesSoldBadgeShow == 2 %} {% sw_include '@Storefront/storefront/themeware/includes/twt-sold-badge-include.html.twig' ignore missing with { product: product, type: 'detail' } %} {% endif %} {% if twtProductBadgesDiscountBadgeType == 1 %} {# Default block #} {% set price = product.calculatedPrice %} {% if product.calculatedPrices.count > 0 %} {% set price = product.calculatedPrices.last %} {% endif %} {% set listPrice = price.listPrice.percentage > 0 %} {% set hasRange = product.calculatedPrices.count > 1 %} {% if listPrice and not hasRange %}
%
{% endif %} {% else %} {# ThemeWare: Add TWT discount badge #} {% sw_include '@Storefront/storefront/themeware/includes/twt-discount-badge-include.html.twig' ignore missing with { product: product, type: 'detail' } %} {% endif %} {% endblock %} {# ThemeWare: Adjustments on the product topseller badge #} {% block component_product_badges_topseller %} {# Default block #} {% if product.markAsTopseller %}
{{ "listing.boxLabelTopseller"|trans|sw_sanitize }}
{% endif %} {% endblock %} {# ThemeWare: Adjustments on the product new badge #} {% block component_product_badges_new %} {# Default block #} {% if product.isNew %}
{{ "listing.boxLabelNew"|trans|sw_sanitize }}
{% endif %} {# ThemeWare: Add TWT stock badge #} {% if twtProductBadgesStockBadgeShow == 2 %} {% sw_include '@Storefront/storefront/themeware/includes/twt-stock-badge-include.html.twig' ignore missing with { product: product, type: 'detail' } %} {% endif %} {% endblock %}
{% endblock %}