
<li class="itemMedium">

    {% set item_image = placeholder_images.item_small.value %}
    {% set item_image_hover = "" %}
    {% set image_alt = item.name %}

    {% if external_image is not empty %}
        {% set item_image = item.image %}
        {% set item_image_hover = "" %}
        {% set image_alt = item.alt %}
    {% endif %}

    {% if item.images is not empty and item.images[item.image_default]['name'] is not empty %}
        {% set item_image = item.images[item.image_default]['name'] %}
        {% set image_alt = item.images[item.image_default]['alt'] %}
    {% endif %}

    {# Set hover image if applicable #}
    {% if item.images is not empty
        and item.images[item.image_hover]['name'] is not empty
        and item.image_default != item.image_hover
        and settings.ITEM_PREVIEW_HOVER_IMAGE == true
    %}
        {% set item_image_hover = item.images[item.image_hover]['name'] %}
    {% endif %}

    {% set main_item_link = item.url %}

    {% if assessment_completed is empty and item.item_assessment_complete is empty and item.product_type == 'doctor' %}

        {% set requires_assessment = true %}

        {# Disable link to assessment forms directly from products #}
        {#
        {% if item.form_id != '0' and item.form_id is not empty %}

            {% set main_item_link = '/shop/assessment.php?id=' ~ item.id %}
            {% set alt_button_text = 'Get started' %}

        {% else %}

            {% if category.id is not empty and category.form_id is not empty and category.form_id != '0' %}
                {% set main_item_link = '/shop/assessment.php?category_id=' ~ category.id %}
                {% set alt_button_text = 'Get started' %}
            {% elseif item.form_category_id is not empty %}
                {% set main_item_link = '/shop/assessment.php?category_id=' ~ item.form_category_id %}
                {% set alt_button_text = 'Get started' %}
            {% endif %}
        {% endif %}
        #}
    {% endif %}

    <div class="innerItem">

        <a href="{{ main_item_link }}" class="cardTop">

            <div class="itemHeader">

                <div class="itemImageWrap{% if item_image_hover is not empty %} hasHoverImage{% endif %}{% if (item_image is empty) %} noImage{% endif %}">

                    <div class="innerImage">
                        {% if (item_image is not empty) %}
                            <img src="{{ settings.STATIC_URL }}/{{ image_folders['product_folders']['thumbs']['path'] }}/{{ item_image }}"
                                 alt="{{ image_alt ?: item.name }}"/>
                        {% else %}
                            <img src="{{ settings.THEME_URL }}/images/placeholders/no-image.jpg" />
                        {% endif %}
                    </div> <!-- .innerImage -->

                </div> <!-- .itemImageWrap -->

                <div class="innerTextBox">

                    <h2>
                        {{ item.name }}
                    </h2>

                    <h4>{{ item.main_category }}</h4>

                </div><!-- .innerTextBox -->

            </div> <!-- .itemHeader -->

            <div class="itemBody {% if show_footer is empty %} noBottomPadding{% endif %}">

                <div class="itemPrices">
                    {% include 'shop/item/partials/item_price_small.twig' with {
                        use_from_price: true
                    }%}
                </div> <!-- .itemPrices -->

                {# Hide button if an assessment is require#}
                {% if requires_assessment is empty %}
                    <div class="itemCTA">

                        <button type="button" class="button buttonOutlined">
                            {% if alt_button_text is empty %}
                                View product
                            {% else %}
                                {{ alt_button_text }}
                            {% endif %}
                        </button>
                    </div> <!-- .itemCTA -->
                {% endif %}

            </div> <!-- .itemBody -->

        </a> <!-- .innerItem -->

        {% if show_footer is not empty %}
            <a href="{{ item.url }}" class="cardBottom">

                <h6>Further information <i class="far fa-long-arrow-right"></i></h6>

                {% if item.custom.description_short is not empty %}
                    <p>
                        {{ item.custom.description_short|striptags|raw|truncate(140)|replace({'...': ''}) }}
                        <span class="readMoreLink">Read more...</span>
                    </p>
                {% endif %}

            </a>
        {% endif %}


        {{ hooks_do_action('item_small_end', item) }}

    </div> <!-- .innerItem -->


</li>
