blob: 2b8ebff3e87753bf6da9d423d968888d09e1af12 [file] [log] [blame]
marinationc8423052021-04-07 23:49:04 +05301# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
2# License: GNU General Public License v3. See license.txt
marinationc8423052021-04-07 23:49:04 +05303import frappe
4from erpnext.e_commerce.doctype.item_review.item_review import get_item_reviews
marination2fec0682021-07-13 23:46:24 +05305from erpnext.e_commerce.doctype.website_item.website_item import check_if_user_is_customer
marinationc8423052021-04-07 23:49:04 +05306
7def get_context(context):
marinationb29c5d62021-05-25 01:35:22 +05308 context.no_cache = 1
marinationc8423052021-04-07 23:49:04 +05309 context.full_page = True
10 context.reviews = None
marinationb29c5d62021-05-25 01:35:22 +053011
marinationc8423052021-04-07 23:49:04 +053012 if frappe.form_dict and frappe.form_dict.get("item_code"):
13 context.item_code = frappe.form_dict.get("item_code")
14 context.web_item = frappe.db.get_value("Website Item", {"item_code": context.item_code}, "name")
marination2fec0682021-07-13 23:46:24 +053015 context.user_is_customer = check_if_user_is_customer()
marinationc8423052021-04-07 23:49:04 +053016 get_item_reviews(context.web_item, 0, 10, context)