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