2021-04-07 23:49:04 +05:30
|
|
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
import frappe
|
2022-02-01 00:39:14 +05:30
|
|
|
|
|
|
|
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import (
|
|
|
|
get_shopping_cart_settings,
|
|
|
|
)
|
2021-04-07 23:49:04 +05:30
|
|
|
from erpnext.e_commerce.doctype.item_review.item_review import get_item_reviews
|
2021-07-13 23:46:24 +05:30
|
|
|
from erpnext.e_commerce.doctype.website_item.website_item import check_if_user_is_customer
|
2022-02-01 00:39:14 +05:30
|
|
|
|
2021-04-07 23:49:04 +05:30
|
|
|
|
|
|
|
def get_context(context):
|
2021-09-01 14:57:50 +05:30
|
|
|
context.body_class = "product-page"
|
2021-05-25 01:35:22 +05:30
|
|
|
context.no_cache = 1
|
2021-04-07 23:49:04 +05:30
|
|
|
context.full_page = True
|
|
|
|
context.reviews = None
|
2021-05-25 01:35:22 +05:30
|
|
|
|
2021-08-25 13:09:35 +05:30
|
|
|
if frappe.form_dict and frappe.form_dict.get("web_item"):
|
|
|
|
context.web_item = frappe.form_dict.get("web_item")
|
2021-07-13 23:46:24 +05:30
|
|
|
context.user_is_customer = check_if_user_is_customer()
|
2021-08-09 21:00:31 +05:30
|
|
|
context.enable_reviews = get_shopping_cart_settings().enable_reviews
|
2021-09-01 14:57:50 +05:30
|
|
|
|
2021-08-09 21:00:31 +05:30
|
|
|
if context.enable_reviews:
|
2021-08-25 13:09:35 +05:30
|
|
|
reviews_data = get_item_reviews(context.web_item)
|
|
|
|
context.update(reviews_data)
|