{% block component_product_badges %}
<div class="product-badges">
{% block component_product_badges_discount %}
{% 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 %}
{% set displayParent = product.variantListingConfig.displayParent and product.parentId === null %}
{% if displayParent %}
{% set displayFromVariants = displayParent and price.unitPrice !== product.calculatedCheapestPrice.unitPrice %}
{% endif %}
{% if listPrice and not hasRange and not displayFromVariants %}
<div class="badge badge-danger badge-discount">
<span>%</span>
</div>
{% endif %}
{% endblock %}
{% block component_product_badges_topseller %}
{% if product.markAsTopseller %}
<div>
<span class="badge badge-warning badge-topseller">{{ "listing.boxLabelTopseller"|trans|sw_sanitize }}</span>
</div>
{% endif %}
{% endblock %}
{% block component_product_badges_new %}
{% if product.isNew %}
<div>
<span class="badge badge-success badge-new">{{ "listing.boxLabelNew"|trans|sw_sanitize }}</span>
</div>
{% endif %}
{% endblock %}
</div>
{% endblock %}