fix: Shop by category fixes (#34688)

* fix: Shop by category fixes

* chore: Update tests
This commit is contained in:
Deepesh Garg
2023-04-05 12:43:32 +05:30
committed by GitHub
parent f193393f57
commit 56f5078357
3 changed files with 25 additions and 4 deletions

View File

@@ -148,12 +148,17 @@ def get_item_for_list_in_html(context):
def get_parent_item_groups(item_group_name, from_item=False):
base_nav_page = {"name": _("All Products"), "route": "/all-products"}
settings = frappe.get_cached_doc("E Commerce Settings")
if settings.enable_field_filters:
base_nav_page = {"name": _("Shop by Category"), "route": "/shop-by-category"}
else:
base_nav_page = {"name": _("All Products"), "route": "/all-products"}
if from_item and frappe.request.environ.get("HTTP_REFERER"):
# base page after 'Home' will vary on Item page
last_page = frappe.request.environ["HTTP_REFERER"].split("/")[-1].split("?")[0]
if last_page and last_page == "shop-by-category":
if last_page and last_page in ("shop-by-category", "all-products"):
base_nav_page_title = " ".join(last_page.split("-")).title()
base_nav_page = {"name": _(base_nav_page_title), "route": "/" + last_page}