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