Skip to content

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

Add new crop sizes, fix product images in storefront Django views

weronka6c7d62f2c2fc
diff --git a/saleor/settings.py b/saleor/settings.py
index 0e56c31041..0485d90c39 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -305,10 +305,13 @@ VERSATILEIMAGEFIELD_RENDITION_KEY_SETS = {
'defaults': [
('list_view', 'crop__100x100'),
('dashboard', 'crop__400x400'),
- ('product_page_mobile', 'crop__680x680'),
- ('product_page_big', 'crop__750x750'),
- ('product_page_thumb', 'crop__280x280')]}
-
+ ('product_gallery', 'crop__540x540'),
+ ('product_gallery_2x', 'crop__1080x1080'),
+ ('product_small', 'crop__60x60'),
+ ('product_small_2x', 'crop__120x120'),
+ ('product_list', 'crop__255x255'),
+ ('product_list_2x', 'crop__510x510')]}
+
VERSATILEIMAGEFIELD_SETTINGS = {
# Images should be pre-generated on Production environment
'create_images_on_demand': ast.literal_eval(
diff --git a/templates/cart-dropdown.html b/templates/cart-dropdown.html
index 27bf00e07f..c5d736818a 100644
--- a/templates/cart-dropdown.html
+++ b/templates/cart-dropdown.html
@@ -10,7 +10,7 @@
<div class="row item">
<div class="col-md-10">
<a href="{{ line.variant_url }}">
- <img class="cart-dropdown__image" src="{% get_thumbnail line.image size="60x60" %}" alt="">
+ <img class="cart-dropdown__image" src="{% get_thumbnail line.image size="60x60" %}" srcset="{% get_thumbnail line.image size="60x60" %} 1x, {% get_thumbnail line.image size="120x120" %} 2x" alt="">
<h3>
{{ line.product }}
<span>x{{ line.quantity }}</span>
diff --git a/templates/order/order-details.html b/templates/order/order-details.html
index 5386c30949..02f76933c5 100644
--- a/templates/order/order-details.html
+++ b/templates/order/order-details.html
@@ -51,7 +51,7 @@
<div class="row">
<div class="col-md-6 col-9">
<a href="{{ item_line.product.get_absolute_url }}">
- <img src="{% product_first_image item_line.product size="60x60" method="crop" %}" class="float-left">
+ <img src="{% product_first_image item_line.product size="60x60" method="crop" %}" srcset="{% product_first_image item_line.product size="60x60" method="crop" %} 1x, {% product_first_image item_line.product size="120x120" method="crop" %} 2x" class="float-left">
<p>{{ item_line.product }}<br>
<span>{{ item_line.product_name }}</span></p>
</a>