Browse Source

Dup button href js func with product id

Vova Tkach 5 years ago
parent
commit
131958b489
1 changed files with 3 additions and 1 deletions
  1. 3 1
      modules/module_shop.go

+ 3 - 1
modules/module_shop.go

@@ -760,7 +760,9 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					{Name: "Add new product"},
 					{Name: "Add new product"},
 				})
 				})
 			} else {
 			} else {
-				content += `<div class="product-copy"><a title="Duplicate product" href="#">` + assets.SysSvgIconCopy + `</a></div>`
+				if len(wrap.UrlArgs) >= 3 && utils.IsNumeric(wrap.UrlArgs[2]) {
+					content += `<div class="product-copy"><a title="Duplicate product" href="javascript:fave.ShopProductsDuplicate(this, ` + wrap.UrlArgs[2] + `);">` + assets.SysSvgIconCopy + `</a></div>`
+				}
 				content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
 				content += this.getBreadCrumbs(wrap, &[]consts.BreadCrumb{
 					{Name: "Modify product"},
 					{Name: "Modify product"},
 				})
 				})