Skip to content

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

Fix order details storefront age with removed product

Anna Siwikf1c10dc24162
diff --git a/saleor/product/templatetags/product_images.py b/saleor/product/templatetags/product_images.py
index ea7319a398..7d40f45a4d 100644
--- a/saleor/product/templatetags/product_images.py
+++ b/saleor/product/templatetags/product_images.py
@@ -70,6 +70,6 @@ def product_first_image(product, size, method='crop'):
"""
Returns main product image
"""
- all_images = product.images.all()
+ all_images = product.images.all() if product else []
main_image = all_images[0].image if all_images else None
return get_thumbnail(main_image, size, method)
diff --git a/saleor/static/scss/layouts/_order-details.scss b/saleor/static/scss/layouts/_order-details.scss
index cae42fb091..5d9920296f 100644
--- a/saleor/static/scss/layouts/_order-details.scss
+++ b/saleor/static/scss/layouts/_order-details.scss
@@ -28,6 +28,9 @@
margin-right: $global-margin;
}
}
+ &__description {
+ line-height: 60px;
+ }
}
&__total {
padding-top: $global-padding;
diff --git a/templates/order/_ordered_items_table.html b/templates/order/_ordered_items_table.html
index da73abb4fb..3f1b60f76e 100644
--- a/templates/order/_ordered_items_table.html
+++ b/templates/order/_ordered_items_table.html
@@ -51,12 +51,11 @@
<div class="table__row order-details__product{% if forloop.last %} order-details__last-row{% endif %}">
<div class="row">
<div class="col-md-6 col-9">
- <a class="link--clean" href="{{ item_line.product.get_absolute_url }}">
+ <a class="link--clean" href="{% if item_line.product %}{{ item_line.product.get_absolute_url }}{% endif %}">
<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>
- <small>{{ item_line.product_name }}</small></p>
+ <span class="order-details__product__description">{{ item_line.product_name }}</span>
</a>
</div>
<div class="col-md-6 col-3">