{% load currency_filters %}
{% load basket_tags %}
{% load thumbnail %}

<article class="product_pod">
    <div class="image_container">
		{% with image=product.primary_image %}
		{% thumbnail image.original "400x400" upscale=False as thumb %}
		<a href="{{ product.get_absolute_url }}"><img class="thumbnail" src="{{ thumb.url }}" alt="{{ product.get_title }}"></a>
		{% endthumbnail %}
		{% endwith %}
    </div>

    {% block product_review %}
        {% with product.reviews.all as reviews %}
            {% if reviews %}
                <ul class="review_count">       
                {% for review in reviews %}
                    <li class="{{ review.score }}">{{ review.score }}</li>
                {% endfor %}
                </ul>
            {% else %}
                 <p class="star">No Rating</p>
            {% endif %}
        {% endwith %}
    {% endblock product_review %}
    
    <h3><a href="{{ product.get_absolute_url }}">{{ product.get_title|truncatewords:7 }}</a></h3>
    
    <div class="product_price">
        {% if product.has_stockrecord %}    
            {% if product.is_group %}
                <h4><span>From</span> {{ product.min_variant_price_incl_tax|currency }}</h4>
            {% else %}
                <h4>{{ product.stockrecord.price_incl_tax|currency }}</h4>
            {% endif %}
            <p class="app-ico {{ product.stockrecord.availability_code }} avaliability ">{{ product.stockrecord.availability|truncatewords:2 }}</p>
        {% else %}
            <p class="app-ico avaliability outofstock">Not available</p>
        {% endif %}

        {% basket_form basket product as basket_form single %}
        <form action="{% url basket:add %}" method="post">
            {% csrf_token %}
            {{ basket_form.as_p }}
            <input type="submit" class="btn btn-primary" value="Add to basket" />
        </form>
    </div>
</article>