Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix displaying product image in cart dropdown
Marcin Gębala7ee86f2af4c7
diff --git a/saleor/cart/views.py b/saleor/cart/views.pyindex a72c65309b..8572e7ced4 100644--- a/saleor/cart/views.py+++ b/saleor/cart/views.py@@ -9,6 +9,7 @@ from django.template.response import TemplateResponsefrom ..core.utils import to_local_currency, get_user_shipping_countryfrom ..product.models import ProductVariant+from ..product.templatetags.product_images import get_thumbnailfrom ..shipping.utils import get_shipment_optionsfrom .forms import ReplaceCartLineForm, CountryFormfrom .models import Cart@@ -114,7 +115,7 @@ def summary(request, cart):'variant': line.variant.name,'quantity': line.quantity,'attributes': line.variant.display_variant(attributes),- 'image': first_image.url if first_image else None,+ 'image': first_image,'price_per_item': currencyfmt(price_per_item.gross, price_per_item.currency),'line_total': currencyfmt(line_total.gross, line_total.currency),diff --git a/templates/cart-dropdown.html b/templates/cart-dropdown.htmlindex 41e815c311..87d4abfde3 100644--- a/templates/cart-dropdown.html+++ b/templates/cart-dropdown.html@@ -1,6 +1,7 @@{% load i18n %}{% load staticfiles %}{% load gross from prices_i18n %}+{% load get_thumbnail from product_images %}<div class="container">{% if quantity > 0 %}@@ -8,7 +9,7 @@<div class="row"><div class="col-md-10"><a href="{{ line.variant_url }}">- <img class="cart-dropdown__image" src="{{ line.image }}" alt="">+ <img class="cart-dropdown__image" src="{% get_thumbnail line.image size="60x60" %}" alt=""><h3>{{ line.product }}<br><small>{{ line.variant }}<br>x {{ line.quantity }}</small>