Skip to content

order_product_info

The order_product_info macro is used to render details about an ordered product.

Definition

{% order_product_info() %}

Input parameters

none

Example

{% from "@macros/order_product_info.twig" import order_product_info %}

{{ order_product_info() }}

Macro source code

{% macro order_product_info(orderProduct) %}
    {% set product = ObjectApi.getProduct(orderProduct.product.product_id) %}

    {% set isProductActive = orderProduct.productObject.translation.active %}

    {% if isProductActive  %}
        <a
            href="{{ product.url }}"
            class="
                p_s
                font_semibold
                link_secondary
                link_no-underline
                color_main
                {% if not orderProduct.hasOptionsRepresentation() %} mb-xs-1 {% endif %}
            "
        >
            {{ orderProduct.product.name }}
        </a>
    {% else %}
        {{ orderProduct.product.name }}
    {% endif %}

    {% if orderProduct.hasOptionsRepresentation() %}
        <p class="p_xs color_secondary">{{ orderProduct.getOptionsString() }}</p>
    {% endif %}

    {% if orderProduct.isParent() %}
        {% if orderProduct.getChildren()|length > 0 %}
            <div class="bundle-products">
                {% for bundle in orderProduct.getChildren() %}
                    <p>
                        {% if isProductActive %}
                            <a href="{{ product.url }}">
                                <span class="bundle-product-name">{{ bundle.product.name }}</span>
                            </a>
                        {% else %}
                            <span class="bundle-product-name">{{ bundle.product.name }}</span>
                        {% endif %}
                    </p>
                {% endfor %}
            </div>
        {% endif %}
    {% endif %}

    <product-shipping-time
        class="property"
        product-id="{{ product.id }}"
        {% if product.delivery is null %}hidden{% endif %}
    >
        <span class="property__key color_main">{{ translate('Shipping time') }}:</span>

        <span
            class="product-shipping-time__time property__value"
            data-shipping-time
        >
            {{ product.delivery.name }}
        </span>
    </product-shipping-time>

    <p class="p_xs color_main font_semibold">
        {{ orderProduct.product.quantity }} x {{ orderProduct.product.unit }}
    </p>
{% endmacro %}

Object Api methods reference