Add correct image for selected variant
This commit is contained in:
parent
4e7453a188
commit
4b8831035e
@ -47,6 +47,7 @@ from core import (
|
||||
OrderStatus
|
||||
)
|
||||
from .forms import (
|
||||
ProductVariantUpdateForm,
|
||||
OrderLineFulfillForm,
|
||||
OrderLineFormset,
|
||||
OrderCancelForm,
|
||||
@ -438,14 +439,7 @@ class ProductVariantUpdateView(SuccessMessageMixin, UpdateView):
|
||||
pk_url_kwarg = 'variant_pk'
|
||||
success_message = 'ProductVariant saved.'
|
||||
template_name = 'dashboard/variant_form.html'
|
||||
fields = [
|
||||
'name',
|
||||
'sku',
|
||||
'price',
|
||||
'weight',
|
||||
'track_inventory',
|
||||
'stock',
|
||||
]
|
||||
form_class = ProductVariantUpdateForm
|
||||
context_object_name = 'variant'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
||||
@ -13,7 +13,11 @@
|
||||
<div class="cart__item">
|
||||
{% with product=item.variant.product %}
|
||||
<figure class="item__figure">
|
||||
{% if item.variant.image %}
|
||||
<img class="item__image" src="{{item.variant.image.image.url}}" alt="{{item.variant.image.image}}">
|
||||
{% else %}
|
||||
<img class="item__image" src="{{product.get_first_img.image.url}}" alt="{{product.get_first_img.image}}">
|
||||
{% endif %}
|
||||
</figure>
|
||||
<div class="item__info">
|
||||
<h3>{{product.name}}</h3>
|
||||
|
||||
@ -23,7 +23,11 @@
|
||||
<tr>
|
||||
{% with product=item.variant.product %}
|
||||
<td>
|
||||
{% if item.variant.image %}
|
||||
<img class="line__image" src="{{item.variant.image.image.url}}" alt="{{item.variant.image.image}}">
|
||||
{% else %}
|
||||
<img class="line__image" src="{{product.get_first_img.image.url}}" alt="{{product.get_first_img.image}}">
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<strong>{{ item.variant }}</strong><br>
|
||||
|
||||
@ -34,7 +34,11 @@
|
||||
<div class="cart__item">
|
||||
{% with product=item.variant.product %}
|
||||
<figure>
|
||||
{% if item.variant.image %}
|
||||
<img src="{{item.variant.image.image.url}}" alt="{{item.variant.image.image}}">
|
||||
{% else %}
|
||||
<img src="{{product.get_first_img.image.url}}" alt="{{product.get_first_img.image}}">
|
||||
{% endif %}
|
||||
</figure>
|
||||
<div>
|
||||
<h3>{{product.name}}</h3>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user