feat(products): улучшить интерфейс массовой синхронизации с Recommerce
- Добавить секцию маркетинговых флагов в модалку синхронизации - Добавить кнопки "Выбрать все" для групп полей - Улучшить UX отображения списка товаров Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -343,6 +343,42 @@ class CombinedProductListView(LoginRequiredMixin, ManagerOwnerRequiredMixin, Lis
|
||||
products = products.filter(tags__id__in=tags).distinct()
|
||||
kits = kits.filter(tags__id__in=tags).distinct()
|
||||
|
||||
# Фильтр по цене
|
||||
price_from = self.request.GET.get('price_from')
|
||||
price_to = self.request.GET.get('price_to')
|
||||
if price_from:
|
||||
products = products.filter(
|
||||
Q(sale_price__gte=price_from) | Q(price__gte=price_from)
|
||||
).distinct()
|
||||
kits = kits.filter(
|
||||
Q(sale_price__gte=price_from) | Q(price__gte=price_from)
|
||||
).distinct()
|
||||
if price_to:
|
||||
products = products.filter(
|
||||
Q(sale_price__lte=price_to) | Q(price__lte=price_to)
|
||||
).distinct()
|
||||
kits = kits.filter(
|
||||
Q(sale_price__lte=price_to) | Q(price__lte=price_to)
|
||||
).distinct()
|
||||
|
||||
# Маркетинговые фильтры (OR логика — объединяются через Q)
|
||||
marketing_filters = Q()
|
||||
if self.request.GET.get('is_new') == '1':
|
||||
marketing_filters |= Q(is_new=True)
|
||||
if self.request.GET.get('is_popular') == '1':
|
||||
marketing_filters |= Q(is_popular=True)
|
||||
if self.request.GET.get('is_special') == '1':
|
||||
marketing_filters |= Q(is_special=True)
|
||||
if marketing_filters:
|
||||
products = products.filter(marketing_filters)
|
||||
kits = kits.filter(marketing_filters)
|
||||
|
||||
# Фильтр по скидке
|
||||
has_discount = self.request.GET.get('has_discount')
|
||||
if has_discount == '1':
|
||||
products = products.filter(sale_price__gt=0)
|
||||
kits = kits.filter(sale_price__gt=0)
|
||||
|
||||
# Применяем фильтр по типу
|
||||
products_list = []
|
||||
kits_list = []
|
||||
@@ -387,6 +423,12 @@ class CombinedProductListView(LoginRequiredMixin, ManagerOwnerRequiredMixin, Lis
|
||||
'in_stock': self.request.GET.get('in_stock', ''),
|
||||
'tags': [int(tag) for tag in self.request.GET.getlist('tags') if tag.isdigit()],
|
||||
'per_page': self.request.GET.get('per_page', '20'),
|
||||
'price_from': self.request.GET.get('price_from', ''),
|
||||
'price_to': self.request.GET.get('price_to', ''),
|
||||
'is_new': self.request.GET.get('is_new', ''),
|
||||
'is_popular': self.request.GET.get('is_popular', ''),
|
||||
'is_special': self.request.GET.get('is_special', ''),
|
||||
'has_discount': self.request.GET.get('has_discount', ''),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user