From ac7bc78afeec9b9cf77cf58d90b88fb013280bae Mon Sep 17 00:00:00 2001 From: prssanna Date: Wed, 20 Jan 2021 17:46:19 +0530 Subject: [PATCH] fix: show product price in item card --- erpnext/portal/product_configurator/utils.py | 7 +++++-- .../web_template/item_card_group/item_card_group.html | 2 +- erpnext/www/all-products/item_row.html | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/portal/product_configurator/utils.py b/erpnext/portal/product_configurator/utils.py index 9ba4cdc5145..4693d44509a 100644 --- a/erpnext/portal/product_configurator/utils.py +++ b/erpnext/portal/product_configurator/utils.py @@ -1,6 +1,7 @@ import frappe from frappe.utils import cint from erpnext.portal.product_configurator.item_variants_cache import ItemVariantsCacheManager +from erpnext.shopping_cart.product_info import get_product_info_for_website def get_field_filter_data(): product_settings = get_product_settings() @@ -356,10 +357,10 @@ def get_items(filters=None, search=None): results = frappe.db.sql(''' SELECT - `tabItem`.`name`, `tabItem`.`item_name`, + `tabItem`.`name`, `tabItem`.`item_name`, `tabItem`.`item_code`, `tabItem`.`website_image`, `tabItem`.`image`, `tabItem`.`web_long_description`, `tabItem`.`description`, - `tabItem`.`route` + `tabItem`.`route`, `tabItem`.`item_group` FROM `tabItem` {left_join} @@ -384,6 +385,8 @@ def get_items(filters=None, search=None): for r in results: r.description = r.web_long_description or r.description r.image = r.website_image or r.image + product_info = get_product_info_for_website(r.item_code, skip_quotation_creation=True).get('product_info') + r.formatted_price = product_info['price'].get('formatted_price') if product_info['price'] else None return results diff --git a/erpnext/shopping_cart/web_template/item_card_group/item_card_group.html b/erpnext/shopping_cart/web_template/item_card_group/item_card_group.html index d39d1b7b501..890ae502c82 100644 --- a/erpnext/shopping_cart/web_template/item_card_group/item_card_group.html +++ b/erpnext/shopping_cart/web_template/item_card_group/item_card_group.html @@ -26,7 +26,7 @@ {%- set item = frappe.get_doc("Item", item) -%} {{ item_card( item.item_name, item.image, item.route, item.description, - item.standard_rate, item.item_group, values['card_' + index + '_featured'], + None, item.item_group, values['card_' + index + '_featured'], True, "Center" ) }} {%- endif -%} diff --git a/erpnext/www/all-products/item_row.html b/erpnext/www/all-products/item_row.html index b5280eacb7f..20fc9a4878c 100644 --- a/erpnext/www/all-products/item_row.html +++ b/erpnext/www/all-products/item_row.html @@ -2,6 +2,6 @@ {{ item_card( item.item_name or item.name, item.website_image or item.image, item.route, item.website_description or item.description, - item.standard_rate, item.item_group + item.formatted_price, item.item_group ) }}