Skip to content

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

Allow to add products without images

Adam Bogdał8114a332ff21
diff --git a/saleor/product/templates/category/index.html b/saleor/product/templates/category/index.html
index 75ba2ce324..2e433b974f 100644
--- a/saleor/product/templates/category/index.html
+++ b/saleor/product/templates/category/index.html
@@ -17,11 +17,13 @@
<div class="row">
{% for product in row %}
<div class="col-sm-6">
- {% if product.images.exists %}
- <a href="{{ product.get_absolute_url }}">
+ <a href="{{ product.get_absolute_url }}">
+ {% if product.images.first %}
<img class="img-responsive" src="{{ product.images.first.image.thumbnail.750x750 }}" alt="">
- </a>
- {% endif %}
+ {% else %}
+ <img class="img-responsive" src="http://placehold.it/750x500/&text=Product Image" alt="">
+ {% endif %}
+ </a>
<h3><a href="{{ product.get_absolute_url }}">{{ product }}</a></h3>
{% if product.is_in_stock %}
{% with price_range=product|discounted_price_range:request.discounts undiscounted=product.get_price_range %}
diff --git a/saleor/product/templates/product/details.html b/saleor/product/templates/product/details.html
index dbb04c738e..83a061b21e 100644
--- a/saleor/product/templates/product/details.html
+++ b/saleor/product/templates/product/details.html
@@ -48,7 +48,11 @@
<hr>
<div class="visible-xs">
- <img class="img-responsive" src="{{ product.images.first.image.thumbnail.750x750 }}" alt="">
+ {% if product.images.first %}
+ <img class="img-responsive" src="{{ product.images.first.image.thumbnail.750x750 }}" alt="">
+ {% else %}
+ <img class="img-responsive" src="http://placehold.it/750x750/&text=Product Image" alt="">
+ {% endif %}
<hr>
</div>
@@ -95,6 +99,10 @@
<img class="img-responsive" src="{{ image.image.thumbnail.750x750 }}" alt="">
</a>
</div>
+ {% empty %}
+ <div class="item active">
+ <img class="img-responsive" src="http://placehold.it/750x750/&text=Product Image" alt="">
+ </div>
{% endfor %}
</div>