search response includes min and max prices
This commit is contained in:
@@ -2,6 +2,7 @@ import logging
|
||||
|
||||
from django.db.models import Q
|
||||
from django.contrib.postgres.search import SearchQuery, SearchRank, SearchVector, TrigramSimilarity
|
||||
from django.db.models import Max, Min
|
||||
|
||||
from products.models import Product
|
||||
|
||||
@@ -189,7 +190,12 @@ def find_related_products_v6(keyword, shipping_cost=None, discount=None, categor
|
||||
if price_max is not None:
|
||||
products_qs = products_qs.filter(price__lt=price_max)
|
||||
|
||||
return set(products_qs)
|
||||
# get min_price and max_price
|
||||
min_price = products_qs.aggregate(Min('price'))
|
||||
max_price = products_qs.aggregate(Max('price'))
|
||||
|
||||
|
||||
return set(products_qs), min_price, max_price
|
||||
|
||||
|
||||
def find_related_products_v4(keyword):
|
||||
|
||||
Reference in New Issue
Block a user