2019-03-19 06:18:32 +00:00
|
|
|
import frappe
|
2021-02-16 13:15:36 +00:00
|
|
|
from frappe.utils import cint
|
2022-01-31 19:09:14 +00:00
|
|
|
|
2021-08-12 13:31:10 +00:00
|
|
|
from erpnext.e_commerce.product_data_engine.filters import ProductFiltersBuilder
|
2019-03-19 06:18:32 +00:00
|
|
|
|
2019-03-20 08:41:22 +00:00
|
|
|
sitemap = 1
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2019-03-19 06:18:32 +00:00
|
|
|
def get_context(context):
|
2021-05-12 19:52:05 +00:00
|
|
|
# Add homepage as parent
|
2021-09-01 09:27:50 +00:00
|
|
|
context.body_class = "product-page"
|
2022-03-28 13:22:46 +00:00
|
|
|
context.parents = [{"name": frappe._("Home"), "route": "/"}]
|
2021-05-12 19:52:05 +00:00
|
|
|
|
|
|
|
filter_engine = ProductFiltersBuilder()
|
|
|
|
context.field_filters = filter_engine.get_field_filters()
|
|
|
|
context.attribute_filters = filter_engine.get_attribute_filters()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
context.page_length = (
|
|
|
|
cint(frappe.db.get_single_value("E Commerce Settings", "products_per_page")) or 20
|
|
|
|
)
|
2019-03-19 06:18:32 +00:00
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
context.no_cache = 1
|