diff --git a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py index 2de47aa4eab..19de403a545 100644 --- a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py +++ b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py @@ -3,7 +3,7 @@ # For license information, please see license.txt import frappe -from frappe.utils import cint +from frappe.utils import cint, comma_and from frappe import _, msgprint from frappe.model.document import Document from frappe.utils import cint diff --git a/erpnext/e_commerce/product_query.py b/erpnext/e_commerce/product_query.py index de3b0eefb92..2dbed0af178 100644 --- a/erpnext/e_commerce/product_query.py +++ b/erpnext/e_commerce/product_query.py @@ -67,9 +67,13 @@ class ProductQuery: # add price and availability info in results for item in result: product_info = get_product_info_for_website(item.item_code, skip_quotation_creation=True).get('product_info') - if product_info: - item.formatted_price = (product_info.get('price') or {}).get('formatted_price') - item.price = (product_info.get('price') or {}).get('price_list_rate') + if product_info and product_info['price']: + item.formatted_mrp = product_info['price'].get('formatted_mrp') + item.formatted_price = product_info['price'].get('formatted_price') + if item.formatted_mrp: + item.discount = product_info['price'].get('formatted_discount_percent') or \ + product_info['price'].get('formatted_discount_rate') + item.price = product_info['price'].get('price_list_rate') if self.settings.show_stock_availability: if item.get("website_warehouse"): diff --git a/erpnext/e_commerce/shopping_cart/cart.py b/erpnext/e_commerce/shopping_cart/cart.py index 011f29cdc6f..7abfb42b243 100644 --- a/erpnext/e_commerce/shopping_cart/cart.py +++ b/erpnext/e_commerce/shopping_cart/cart.py @@ -11,7 +11,7 @@ from frappe.utils.nestedset import get_root_of from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import get_shopping_cart_settings from erpnext.accounts.utils import get_account_name -from erpnext.utilities.product import get_qty_in_stock +from erpnext.utilities.product import get_web_item_qty_in_stock class WebsitePriceListMissingError(frappe.ValidationError): @@ -93,7 +93,7 @@ def place_order(): item.item_code, ["website_warehouse", "is_stock_item"]) if is_stock_item: - item_stock = get_qty_in_stock(item.item_code, "website_warehouse") + item_stock = get_web_item_qty_in_stock(item.item_code, "website_warehouse") if not cint(item_stock.in_stock): throw(_("{1} Not in Stock").format(item.item_code)) if item.qty > item_stock.stock_qty[0][0]: diff --git a/erpnext/e_commerce/shopping_cart/product_info.py b/erpnext/e_commerce/shopping_cart/product_info.py index 352900284d6..cd47174b963 100644 --- a/erpnext/e_commerce/shopping_cart/product_info.py +++ b/erpnext/e_commerce/shopping_cart/product_info.py @@ -8,7 +8,7 @@ from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import ( get_shopping_cart_settings, show_quantity_in_website ) -from erpnext.utilities.product import get_price, get_qty_in_stock, get_non_stock_item_status +from erpnext.utilities.product import get_price, get_web_item_qty_in_stock, get_non_stock_item_status @frappe.whitelist(allow_guest=True) def get_product_info_for_website(item_code, skip_quotation_creation=False): @@ -30,8 +30,7 @@ def get_product_info_for_website(item_code, skip_quotation_creation=False): cart_settings.default_customer_group, cart_settings.company ) - - stock_status = get_qty_in_stock(item_code, "website_warehouse") + stock_status = get_web_item_qty_in_stock(item_code, "website_warehouse") product_info = { "price": price, diff --git a/erpnext/public/scss/shopping_cart.scss b/erpnext/public/scss/shopping_cart.scss index 905d7e6d498..d7b0cca4874 100644 --- a/erpnext/public/scss/shopping_cart.scss +++ b/erpnext/public/scss/shopping_cart.scss @@ -68,7 +68,7 @@ body.product-page { .item-card-group-section { .card { - height: 360px; + height: 400px; align-items: center; justify-content: center; @@ -134,6 +134,11 @@ body.product-page { } .item-card { + padding: var(--padding-sm); + min-width: 300px; + } + + .wishlist-card { padding: var(--padding-sm); min-width: 260px; } @@ -626,8 +631,7 @@ body.product-page { .btn-explore-variants { box-shadow: none; margin: var(--margin-sm) 0; - margin-left: 18px; - max-height: 30px; // to avoid resizing on window resize + max-height: 50px; // to avoid resizing on window resize flex: none; transition: 0.3s ease; color: var(--orange-500); @@ -643,13 +647,12 @@ body.product-page { .btn-add-to-cart-list{ box-shadow: none; margin: var(--margin-sm) 0; - max-height: 30px; // to avoid resizing on window resize + max-height: 50px; // to avoid resizing on window resize flex: none; transition: 0.3s ease; } .not-added { - margin-left: 18px; color: var(--blue-500); background-color: white; border: 1px solid var(--blue-500); @@ -661,7 +664,6 @@ body.product-page { } .added-to-cart { - margin-left: 18px; background-color: var(--dark-green-400); color: white; border: 2px solid var(--green-300); diff --git a/erpnext/templates/generators/item/item.html b/erpnext/templates/generators/item/item.html index 5f027f7363b..427e568aa86 100644 --- a/erpnext/templates/generators/item/item.html +++ b/erpnext/templates/generators/item/item.html @@ -39,7 +39,7 @@ {{ doc.website_content or '' }} - {% if shopping_cart.cart_settings.enable_reviews %} + {% if shopping_cart.cart_settings.enable_reviews and not doc.has_variants %} {% include "templates/generators/item/item_reviews.html"%} {% endif %} diff --git a/erpnext/templates/generators/item/item_add_to_cart.html b/erpnext/templates/generators/item/item_add_to_cart.html index 3af360f253f..97a04807519 100644 --- a/erpnext/templates/generators/item/item_add_to_cart.html +++ b/erpnext/templates/generators/item/item_add_to_cart.html @@ -7,9 +7,21 @@