2021-04-07 18:19:04 +00:00
|
|
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
import frappe
|
|
|
|
from erpnext.e_commerce.doctype.item_review.item_review import get_item_reviews
|
2021-07-13 18:16:24 +00:00
|
|
|
from erpnext.e_commerce.doctype.website_item.website_item import check_if_user_is_customer
|
2021-04-07 18:19:04 +00:00
|
|
|
|
|
|
|
def get_context(context):
|
2021-05-24 20:05:22 +00:00
|
|
|
context.no_cache = 1
|
2021-04-07 18:19:04 +00:00
|
|
|
context.full_page = True
|
|
|
|
context.reviews = None
|
2021-05-24 20:05:22 +00:00
|
|
|
|
2021-04-07 18:19:04 +00:00
|
|
|
if frappe.form_dict and frappe.form_dict.get("item_code"):
|
|
|
|
context.item_code = frappe.form_dict.get("item_code")
|
|
|
|
context.web_item = frappe.db.get_value("Website Item", {"item_code": context.item_code}, "name")
|
2021-07-13 18:16:24 +00:00
|
|
|
context.user_is_customer = check_if_user_is_customer()
|
2021-04-07 18:19:04 +00:00
|
|
|
get_item_reviews(context.web_item, 0, 10, context)
|