Browse Source

Product custom field modify action, display custom field value

Vova Tkach 5 years ago
parent
commit
db52944945
2 changed files with 14 additions and 4 deletions
  1. 2 2
      modules/module_shop.go
  2. 12 2
      modules/module_shop_act_modify.go

+ 2 - 2
modules/module_shop.go

@@ -1518,7 +1518,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 									<label for="lbl_custom1">` + (*wrap.Config).Shop.CustomFields.Field1.Caption + `</label>
 								</div>
 								<div class="col-md-9">
-									<div><input class="form-control" type="text" id="lbl_custom1" name="custom1" value="" maxlength="2048" autocomplete="off"></div>
+									<div><input class="form-control" type="text" id="lbl_custom1" name="custom1" value="` + html.EscapeString(data.A_custom1) + `" maxlength="2048" autocomplete="off"></div>
 								</div>
 							</div>
 						</div>`
@@ -1539,7 +1539,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 									<label for="lbl_custom2">` + (*wrap.Config).Shop.CustomFields.Field2.Caption + `</label>
 								</div>
 								<div class="col-md-9">
-									<div><input class="form-control" type="text" id="lbl_custom2" name="custom2" value="" maxlength="2048" autocomplete="off"></div>
+									<div><input class="form-control" type="text" id="lbl_custom2" name="custom2" value="` + html.EscapeString(data.A_custom2) + `" maxlength="2048" autocomplete="off"></div>
 								</div>
 							</div>
 						</div>`

+ 12 - 2
modules/module_shop_act_modify.go

@@ -27,6 +27,8 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 		pf_briefly := utils.Trim(wrap.R.FormValue("briefly"))
 		pf_content := utils.Trim(wrap.R.FormValue("content"))
 		pf_active := utils.Trim(wrap.R.FormValue("active"))
+		pf_custom1 := utils.Trim(wrap.R.FormValue("custom1"))
+		pf_custom2 := utils.Trim(wrap.R.FormValue("custom2"))
 
 		if pf_active == "" {
 			pf_active = "0"
@@ -112,7 +114,9 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 						briefly = ?,
 						content = ?,
 						datetime = ?,
-						active = ?
+						active = ?,
+						custom1 = ?,
+						custom2 = ?
 					;`,
 					wrap.User.A_id,
 					utils.StrToInt(pf_currency),
@@ -128,6 +132,8 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 					pf_content,
 					utils.UnixTimestampToMySqlDateTime(utils.GetCurrentUnixTimestamp()),
 					utils.StrToInt(pf_active),
+					pf_custom1,
+					pf_custom2,
 				)
 				if err != nil {
 					return err
@@ -230,7 +236,9 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 						category = ?,
 						briefly = ?,
 						content = ?,
-						active = ?
+						active = ?,
+						custom1 = ?,
+						custom2 = ?
 					WHERE
 						id = ?
 					;`,
@@ -246,6 +254,8 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 					pf_briefly,
 					pf_content,
 					utils.StrToInt(pf_active),
+					pf_custom1,
+					pf_custom2,
 					utils.StrToInt(pf_id),
 				); err != nil {
 					return err