{% import '@CoreShopFrontend/Common/Macro/currency.html.twig' as currency %}

{% set productUrl = pimcore_object_path(item.product) %}

<tr class="shopping-cart-item">
    <td class="text-center">
        {% if item.product and item.product.image is pimcore_asset_image %}
            <a href="{{ productUrl }}">
                {{ item.product.image|pimcore_image_thumbnail_html('coreshop_productCart', {'imgAttributes': {'class': 'img-fluid'}, 'alt': item.product.name, 'title': item.product.name}) }}
            </a>
        {% endif %}
    </td>
    <td class="text-center">
        <a href="{{ productUrl }}">
            {{ item.product.name }}
        </a>
        {% if item.isGiftItem %}
            <br/><span>{{ 'coreshop.ui.gift_item'|trans }}</span>
        {% endif %}
    </td>
    <td class="text-center">
        <span>{{ item.quantity }}</span>
        {% if item.hasUnitDefinition %}
            <span class="unit-definition unit-name">{{ item.unitDefinition.unit.name }}</span>
        {% endif %}
    </td>
    <td class="text-right cart-item-price">
        {% set price = item.itemPrice %}
        {% set discount = item.itemDiscount %}
        {% set discountPrice = item.itemDiscountPrice %}
        {% set retailPrice = item.itemRetailPrice %}

        {% if price < retailPrice %}
            {% if discountPrice > 0 %}
                <span class="price-old">{{ currency.convertAndFormat(retailPrice) }}</span>
            {% endif %}
            {% if discount > 0 %}
                <span class="price-discount">(-{{ currency.convertAndFormat(discount) }})</span>
            {% endif %}
        {% endif %}

        {{ currency.convertAndFormat(price) }}
    </td>
    <td class="text-right cart-item-total-price">
        {{ currency.convertAndFormat(item.total) }}
    </td>
</tr>
