feat: Add search fields field
This commit is contained in:
parent
e82833f14a
commit
3160187825
@ -44,7 +44,9 @@
|
||||
"enable_attribute_filters",
|
||||
"filter_attributes",
|
||||
"shop_by_category_section",
|
||||
"slideshow"
|
||||
"slideshow",
|
||||
"item_search_settings_section",
|
||||
"search_index_fields"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@ -300,12 +302,23 @@
|
||||
"fieldname": "enable_reviews",
|
||||
"fieldtype": "Check",
|
||||
"label": "Enable Reviews and Ratings"
|
||||
},
|
||||
{
|
||||
"fieldname": "search_index_fields",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Search Index Fields"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "item_search_settings_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Item Search Settings"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2021-03-23 17:15:01.956630",
|
||||
"modified": "2021-04-23 13:30:50.286088",
|
||||
"modified_by": "Administrator",
|
||||
"module": "E-commerce",
|
||||
"name": "E Commerce Settings",
|
||||
|
@ -24,6 +24,7 @@ class ECommerceSettings(Document):
|
||||
self.validate_field_filters()
|
||||
self.validate_attribute_filters()
|
||||
self.validate_checkout()
|
||||
self.validate_search_index_fields()
|
||||
if self.enabled:
|
||||
self.validate_exchange_rates_exist()
|
||||
|
||||
@ -51,6 +52,16 @@ class ECommerceSettings(Document):
|
||||
if self.enable_checkout and not self.payment_gateway_account:
|
||||
self.enable_checkout = 0
|
||||
|
||||
def validate_search_index_fields(self):
|
||||
if not self.search_index_fields:
|
||||
return
|
||||
|
||||
# Clean up
|
||||
fields = self.search_index_fields.replace(' ', '')
|
||||
fields = fields.strip(',')
|
||||
|
||||
self.search_index_fields = fields
|
||||
|
||||
def validate_exchange_rates_exist(self):
|
||||
"""check if exchange rates exist for all Price List currencies (to company's currency)"""
|
||||
company_currency = frappe.get_cached_value('Company', self.company, "default_currency")
|
||||
|
Loading…
x
Reference in New Issue
Block a user