Browse Source

Product custom fields config save action

Vova Tkach 5 years ago
parent
commit
cd60cee393
1 changed files with 12 additions and 0 deletions
  1. 12 0
      modules/module_settings_act_shop.go

+ 12 - 0
modules/module_settings_act_shop.go

@@ -29,6 +29,12 @@ func (this *Modules) RegisterAction_SettingsShop() *Action {
 
 		pf_accept_orders := utils.Trim(wrap.R.FormValue("accept-orders"))
 
+		pf_custom_field_1_enabled := utils.Trim(wrap.R.FormValue("custom-field-1-enabled"))
+		pf_custom_field_1_caption := utils.Trim(wrap.R.FormValue("custom-field-1-caption"))
+
+		pf_custom_field_2_enabled := utils.Trim(wrap.R.FormValue("custom-field-2-enabled"))
+		pf_custom_field_2_caption := utils.Trim(wrap.R.FormValue("custom-field-2-caption"))
+
 		if !utils.IsNumeric(pf_price_fomat) {
 			wrap.MsgError(`Must be integer number`)
 			return
@@ -107,6 +113,12 @@ func (this *Modules) RegisterAction_SettingsShop() *Action {
 
 		(*wrap.Config).Shop.Orders.Enabled = utils.StrToInt(pf_accept_orders)
 
+		(*wrap.Config).Shop.CustomFields.Field1.Enabled = utils.StrToInt(pf_custom_field_1_enabled)
+		(*wrap.Config).Shop.CustomFields.Field1.Caption = pf_custom_field_1_caption
+
+		(*wrap.Config).Shop.CustomFields.Field2.Enabled = utils.StrToInt(pf_custom_field_2_enabled)
+		(*wrap.Config).Shop.CustomFields.Field2.Caption = pf_custom_field_2_caption
+
 		if err := wrap.ConfigSave(); err != nil {
 			wrap.MsgError(err.Error())
 			return