added search filter by min and max price

This commit is contained in:
Sam
2021-02-23 12:55:02 +00:00
parent a7740dc1a2
commit e94e0c2dd5
3 changed files with 60 additions and 4 deletions

View File

@@ -177,6 +177,8 @@ def product_search(request):
discount = None
category = request.GET.get('category', None)
tags = request.GET.get('tags', None)
price_min = request.GET.get('price_min', None)
price_max = request.GET.get('price_max', None)
if query_string is None:
return Response({"errors": {"details": "No query string to parse"}})
@@ -193,7 +195,7 @@ def product_search(request):
# split query string into single words
chunks = query_string.split(' ')
for chunk in chunks:
product_set = find_related_products_v6(chunk, shipping_cost, discount, category, tags)
product_set = find_related_products_v6(chunk, shipping_cost, discount, category, tags, price_min, price_max)
# add to result set
result_set.update(product_set)
# TODO: add search for entire phrase ???