added search filter by tags

This commit is contained in:
Sam
2021-02-23 12:44:54 +00:00
parent 28d61c75c0
commit a7740dc1a2
3 changed files with 32 additions and 2 deletions

View File

@@ -125,7 +125,7 @@ def find_related_products_v3(keyword):
return set(products_qs)
def find_related_products_v6(keyword, shipping_cost=None, discount=None, category=None):
def find_related_products_v6(keyword, shipping_cost=None, discount=None, category=None, tags=None):
"""
Ranked product search
@@ -147,6 +147,10 @@ def find_related_products_v6(keyword, shipping_cost=None, discount=None, categor
if category is not None:
products_qs = products_qs.filter(category=category)
# filter by tags
if tags is not None:
products_qs = products_qs.filter(tags=tags)
# filter for shipping cost
if shipping_cost is True:
# only instances with shipping costs