Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add thumbnails as carousel navigation,

Paweł Kowalewskic5ebd2b47e1f
diff --git a/saleor/product/templates/product/details.html b/saleor/product/templates/product/details.html
index 6d979b557a..32201f78ba 100644
--- a/saleor/product/templates/product/details.html
+++ b/saleor/product/templates/product/details.html
@@ -42,8 +42,21 @@
<hr>
+ {% if related_products %}
+ <label>{% trans "This collection" %}</label>
+
+ <div class="row product-related">
+ {% for related in related_products %}
+ <a href="{{ related.get_absolute_url }}" class="col-xs-3">
+ <img src="{{ related.images.first|at_size:"small" }}" alt=""
+ class="thumbnail img-responsive{% if related.id == product.id %} active{% endif %}">
+ </a>
+ {% endfor %}
+ </div>
+ {% endif %}
+
{% block orderform %}
- <form role="form" class="form-vertical" method="post" action=".">
+ <form role="form" class="product-form form-vertical" method="post" action=".">
{% csrf_token %}
{{ form|as_vertical_form }}
@@ -57,14 +70,6 @@
<hr>
- {% if related_products %}
- <h3>{% trans "Also in this collection" %}</h3>
- {% for related in related_products %}
- <a href="{{ related.get_absolute_url }}"><img src="{{ related.images.first|at_size:"small" }}"></a>
- {% endfor %}
- <hr>
- {% endif %}
-
<div itemprop="description">
{{ product.description|markdown }}
</div>
@@ -95,10 +100,34 @@
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
+
+ <div class="product-gallery row">
+ {% for image in images %}
+ <a href="#" class="product-gallery-item col-xs-2">
+ <img class="thumbnail img-responsive" src="{{ image|at_size:"small" }}" alt="">
+ </a>
+ {% endfor %}
+ </div>
</div>
{% endwith %}
</div>
</div>
{% endwith %}
{% endwith %}
-{% endblock outercontent %}
\ No newline at end of file
+{% endblock outercontent %}
+
+{% block footer_scripts %}
+ {{ block.super }}
+ <script>
+ $(function() {
+ var $carousel = $('.carousel'),
+ $items = $('.product-gallery-item');
+
+ $items.on('click', function() {
+ var index = $(this).index();
+
+ $carousel.carousel(index);
+ })
+ });
+ </script>
+{% endblock %}
\ No newline at end of file