diff --git a/erpnext/e_commerce/doctype/website_item/website_item.py b/erpnext/e_commerce/doctype/website_item/website_item.py index 6957ae76343..5b04a98f716 100644 --- a/erpnext/e_commerce/doctype/website_item/website_item.py +++ b/erpnext/e_commerce/doctype/website_item/website_item.py @@ -195,7 +195,7 @@ class WebsiteItem(WebsiteGenerator): get_item_reviews(self.name, 0, 4, context) context.wished = False - if frappe.db.exists("Wishlist Items", {"item_code": self.item_code, "parent": frappe.session.user}): + if frappe.db.exists("Wishlist Item", {"item_code": self.item_code, "parent": frappe.session.user}): context.wished = True context.user_is_customer = check_if_user_is_customer() diff --git a/erpnext/e_commerce/doctype/wishlist/wishlist.json b/erpnext/e_commerce/doctype/wishlist/wishlist.json index ae24207d5f0..922924e53b0 100644 --- a/erpnext/e_commerce/doctype/wishlist/wishlist.json +++ b/erpnext/e_commerce/doctype/wishlist/wishlist.json @@ -28,13 +28,13 @@ "fieldname": "items", "fieldtype": "Table", "label": "Items", - "options": "Wishlist Items" + "options": "Wishlist Item" } ], "in_create": 1, "index_web_pages_for_search": 1, "links": [], - "modified": "2021-03-24 20:42:58.402031", + "modified": "2021-07-08 13:11:21.693956", "modified_by": "Administrator", "module": "E-commerce", "name": "Wishlist", diff --git a/erpnext/e_commerce/doctype/wishlist/wishlist.py b/erpnext/e_commerce/doctype/wishlist/wishlist.py index c817657a503..94f19ff215b 100644 --- a/erpnext/e_commerce/doctype/wishlist/wishlist.py +++ b/erpnext/e_commerce/doctype/wishlist/wishlist.py @@ -13,11 +13,11 @@ class Wishlist(Document): def add_to_wishlist(item_code, price, formatted_price=None): """Insert Item into wishlist.""" - if frappe.db.exists("Wishlist Items", {"item_code": item_code, "parent": frappe.session.user}): + if frappe.db.exists("Wishlist Item", {"item_code": item_code, "parent": frappe.session.user}): return web_item_data = frappe.db.get_value("Website Item", {"item_code": item_code}, - ["image", "website_warehouse", "name", "item_name", "item_group", "route"] + ["image", "website_warehouse", "name", "web_item_name", "item_name", "item_group", "route"] , as_dict=1) wished_item_dict = { @@ -25,6 +25,7 @@ def add_to_wishlist(item_code, price, formatted_price=None): "item_name": web_item_data.get("item_name"), "item_group": web_item_data.get("item_group"), "website_item": web_item_data.get("name"), + "web_item_name": web_item_data.get("web_item_name"), "price": frappe.utils.flt(price), "formatted_price": formatted_price, "image": web_item_data.get("image"), @@ -48,10 +49,10 @@ def add_to_wishlist(item_code, price, formatted_price=None): @frappe.whitelist() def remove_from_wishlist(item_code): - if frappe.db.exists("Wishlist Items", {"item_code": item_code, "parent": frappe.session.user}): + if frappe.db.exists("Wishlist Item", {"item_code": item_code, "parent": frappe.session.user}): frappe.db.sql(""" delete - from `tabWishlist Items` + from `tabWishlist Item` where item_code=%(item_code)s """ % {"item_code": frappe.db.escape(item_code)}) diff --git a/erpnext/e_commerce/doctype/wishlist_items/__init__.py b/erpnext/e_commerce/doctype/wishlist_item/__init__.py similarity index 100% rename from erpnext/e_commerce/doctype/wishlist_items/__init__.py rename to erpnext/e_commerce/doctype/wishlist_item/__init__.py diff --git a/erpnext/e_commerce/doctype/wishlist_items/wishlist_items.json b/erpnext/e_commerce/doctype/wishlist_item/wishlist_item.json similarity index 91% rename from erpnext/e_commerce/doctype/wishlist_items/wishlist_items.json rename to erpnext/e_commerce/doctype/wishlist_item/wishlist_item.json index 6623921f187..aecdbdda192 100644 --- a/erpnext/e_commerce/doctype/wishlist_items/wishlist_items.json +++ b/erpnext/e_commerce/doctype/wishlist_item/wishlist_item.json @@ -7,6 +7,7 @@ "field_order": [ "item_code", "website_item", + "web_item_name", "column_break_3", "item_name", "item_group", @@ -126,15 +127,23 @@ "fieldname": "formatted_price", "fieldtype": "Data", "label": "Formatted Price" + }, + { + "fetch_from": "website_item.web_item_name", + "fetch_if_empty": 1, + "fieldname": "web_item_name", + "fieldtype": "Data", + "label": "Webiste Item Name", + "read_only": 1 } ], "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2021-03-18 16:04:52.965613", + "modified": "2021-07-08 13:14:14.919749", "modified_by": "Administrator", "module": "E-commerce", - "name": "Wishlist Items", + "name": "Wishlist Item", "owner": "Administrator", "permissions": [], "sort_field": "modified", diff --git a/erpnext/e_commerce/doctype/wishlist_items/wishlist_items.py b/erpnext/e_commerce/doctype/wishlist_item/wishlist_item.py similarity index 88% rename from erpnext/e_commerce/doctype/wishlist_items/wishlist_items.py rename to erpnext/e_commerce/doctype/wishlist_item/wishlist_item.py index 25ce17d655b..ee08cfea597 100644 --- a/erpnext/e_commerce/doctype/wishlist_items/wishlist_items.py +++ b/erpnext/e_commerce/doctype/wishlist_item/wishlist_item.py @@ -6,5 +6,5 @@ from __future__ import unicode_literals # import frappe from frappe.model.document import Document -class WishlistItems(Document): +class WishlistItem(Document): pass diff --git a/erpnext/e_commerce/product_query.py b/erpnext/e_commerce/product_query.py index f73a20114e3..26de08b7f0c 100644 --- a/erpnext/e_commerce/product_query.py +++ b/erpnext/e_commerce/product_query.py @@ -80,7 +80,7 @@ class ProductQuery: self.get_stock_availability(item) item.wished = False - if frappe.db.exists("Wishlist Items", {"item_code": item.item_code, "parent": frappe.session.user}): + if frappe.db.exists("Wishlist Item", {"item_code": item.item_code, "parent": frappe.session.user}): item.wished = True discounts = [] diff --git a/erpnext/public/scss/shopping_cart.scss b/erpnext/public/scss/shopping_cart.scss index f13c64b6cc6..c57b62d6f2a 100644 --- a/erpnext/public/scss/shopping_cart.scss +++ b/erpnext/public/scss/shopping_cart.scss @@ -63,7 +63,6 @@ body.product-page { border-radius: var(--border-radius); font-size: 2rem; color: var(--gray-500); - font-size: 52px; display: flex; align-items: center; justify-content: center; diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html index 735c6f71cba..a7560b07904 100644 --- a/erpnext/templates/includes/macros.html +++ b/erpnext/templates/includes/macros.html @@ -144,7 +144,7 @@ {%- macro wishlist_card(item, settings) %} -{%- set title = item.item_name or item.item_code -%} +{%- set title = item.web_item_name or ''-%} {%- set title = title[:50] + "..." if title|len > 50 else title -%}