Browse Source

Add product group name to mysql struct and CP modify form

Vova Tkach 5 years ago
parent
commit
e6480f0e51
2 changed files with 22 additions and 0 deletions
  1. 21 0
      modules/module_shop.go
  2. 1 0
      utils/mysql_struct_shop_product.go

+ 21 - 0
modules/module_shop.go

@@ -876,6 +876,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 				A_user:     0,
 				A_currency: 0,
 				A_price:    0,
+				A_gname:    "",
 				A_name:     "",
 				A_alias:    "",
 				A_vendor:   "",
@@ -901,6 +902,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 						user,
 						currency,
 						price,
+						gname,
 						name,
 						alias,
 						vendor,
@@ -921,6 +923,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					&data.A_user,
 					&data.A_currency,
 					&data.A_price,
+					&data.A_gname,
 					&data.A_name,
 					&data.A_alias,
 					&data.A_vendor,
@@ -1016,6 +1019,24 @@ func (this *Modules) RegisterModule_Shop() *Module {
 						return ""
 					},
 				},
+				{
+					Kind: builder.DFKText,
+					CallBack: func(field *builder.DataFormField) string {
+						if data.A_id >= 1 && data.A_parent_id() <= 0 {
+							return `<div class="form-group nf">` +
+								`<div class="row">` +
+								`<div class="col-md-3">` +
+								`<label for="lbl_gname">Group name</label>` +
+								`</div>` +
+								`<div class="col-md-9">` +
+								`<div><input class="form-control" type="text" id="lbl_gname" name="gname" value="` + html.EscapeString(data.A_gname) + `" maxlength="255" autocomplete="off"></div>` +
+								`</div>` +
+								`</div>` +
+								`</div>`
+						}
+						return ""
+					},
+				},
 				{
 					Kind:     builder.DFKText,
 					Caption:  "Product name",

+ 1 - 0
utils/mysql_struct_shop_product.go

@@ -10,6 +10,7 @@ type MySql_shop_product struct {
 	A_user     int
 	A_currency int
 	A_price    float64
+	A_gname    string
 	A_name     string
 	A_alias    string
 	A_vendor   string