{% set today= "now"|date("Y-m-d") %} {% set found1Tama = 0 %} {% for discount in discounts %} {% if (discount.getDiscounts().getDateStart()|date("Y-m-d") <= today and discount.getDiscounts().getDateEnd()|date("Y-m-d") >= today) or (discount.getDiscounts().getDateStart()|date("Y-m-d") <= today and discount.getDiscounts().getDateEnd() is null) %} {% set found1Tama = found1Tama + 1 %} {% endif %} {% endfor %} {% if discounts | length > 0 and found1Tama > 0 %} {% for discount in discounts %} {% if loop.index == found1Tama %}
{% if discount.getDiscounts().avoidTextAndHideDiscount == false %}
PVP

{% if (discount.typeDiscount.id == constant('CoreBundle\\Entity\\TypeDiscount::TYPE_DISCOUNT_AMOUNT') )%} {{ discount.amount }}€ {% else %} {% set articlePrice = discount.discounts.getArticlePVPForThisDiscount(obj.stock.article.id) %} {% if articlePrice is not null %} {% set useThisPVP = articlePrice %} {% else %} {% set useThisPVP = obj.stock.pvp %} {% endif %} {% set priceRound = (useThisPVP - ( (useThisPVP * discount.amount ) / 100 ) ) %} {{ priceRound | rounded_price(discount.roundJson) | number_format(2, ',', '.') }}€ {% endif %}


TARIFA: {{ discount.discounts.name | truncate(18, false, '.') }}
Del {{ discount.discounts.dateStart | date('d-m-Y') }} {% if discount.discounts.dateEnd %} al {{ discount.discounts.dateEnd | date('d-m-Y') }} {% endif %}
{% else %}
PVP

{% if (discount.typeDiscount.id == constant('CoreBundle\\Entity\\TypeDiscount::TYPE_DISCOUNT_AMOUNT') )%} {{ discount.amount }}€ {% else %} {% set articlePrice = discount.discounts.getArticlePVPForThisDiscount(obj.stock.article.id) %} {% if articlePrice is not null %} {% set useThisPVP = articlePrice %} {% else %} {% set useThisPVP = obj.stock.pvp %} {% endif %} {% set priceRound = (useThisPVP - ( (useThisPVP * discount.amount ) / 100 ) ) %} {{ priceRound | rounded_price(discount.roundJson) | number_format(2, ',', '.') }}€ {% endif %}

{% endif %}
{% endif %} {% endfor %} {% else %} PVP

{{ obj.stock.getPvpForSale | number_format(2, ',', '.') }}€

{% endif %}