fix: show product price in item card

This commit is contained in:
prssanna 2021-01-20 17:46:19 +05:30
parent 599322871a
commit ac7bc78afe
3 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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 -%}

View File

@ -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
) }}