Browse Source

Reset products XML cache on any Shop module action in CP

Vova Tkach 5 years ago
parent
commit
b33e8d41e0

+ 3 - 0
modules/module_shop_act_delete.go

@@ -55,6 +55,9 @@ func (this *Modules) RegisterAction_ShopDelete() *Action {
 			return
 			return
 		}
 		}
 
 
+		// Delete products XML cache
+		wrap.RemoveProductXmlCacheFile()
+
 		// Reload current page
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 		wrap.Write(`window.location.reload(false);`)
 	})
 	})

+ 8 - 0
modules/module_shop_act_modify.go

@@ -183,6 +183,10 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 				wrap.MsgError(err.Error())
 				wrap.MsgError(err.Error())
 				return
 				return
 			}
 			}
+
+			// Delete products XML cache
+			wrap.RemoveProductXmlCacheFile()
+
 			wrap.Write(`window.location='/cp/shop/modify/` + utils.Int64ToStr(lastID) + `/';`)
 			wrap.Write(`window.location='/cp/shop/modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 		} else {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
@@ -294,6 +298,10 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 				wrap.MsgError(err.Error())
 				wrap.MsgError(err.Error())
 				return
 				return
 			}
 			}
+
+			// Delete products XML cache
+			wrap.RemoveProductXmlCacheFile()
+
 			wrap.Write(`window.location='/cp/shop/modify/` + pf_id + `/';`)
 			wrap.Write(`window.location='/cp/shop/modify/` + pf_id + `/';`)
 		}
 		}
 	})
 	})

+ 3 - 0
modules/module_shop_act_upload_delete.go

@@ -57,6 +57,9 @@ func (this *Modules) RegisterAction_ShopUploadDelete() *Action {
 			return
 			return
 		}
 		}
 
 
+		// Delete products XML cache
+		wrap.RemoveProductXmlCacheFile()
+
 		wrap.Write(`$('#list-images a').each(function(i, e) { if($(e).attr('title') == '` + pf_file + `') { $(e).parent().remove(); return; } });`)
 		wrap.Write(`$('#list-images a').each(function(i, e) { if($(e).attr('title') == '` + pf_file + `') { $(e).parent().remove(); return; } });`)
 	})
 	})
 }
 }

+ 3 - 0
modules/module_shop_act_upload_image.go

@@ -92,6 +92,9 @@ func (this *Modules) RegisterAction_ShopUploadImage() *Action {
 			return
 			return
 		}
 		}
 
 
+		// Delete products XML cache
+		wrap.RemoveProductXmlCacheFile()
+
 		wrap.Write(`$('#list-images').append('<div class="attached-img"><a href="/products/images/` + pf_id + `/` + target_file_name + `" title="` + target_file_name + `" target="_blank"><img src="/products/images/` + pf_id + `/thumb-0-` + target_file_name + `" /></a>, <a href="javascript:fave.ShopProductsDeleteImage(this, ` + pf_id + `, \'` + target_file_name + `\');">Delete</a></div>');`)
 		wrap.Write(`$('#list-images').append('<div class="attached-img"><a href="/products/images/` + pf_id + `/` + target_file_name + `" title="` + target_file_name + `" target="_blank"><img src="/products/images/` + pf_id + `/thumb-0-` + target_file_name + `" /></a>, <a href="javascript:fave.ShopProductsDeleteImage(this, ` + pf_id + `, \'` + target_file_name + `\');">Delete</a></div>');`)
 	})
 	})
 }
 }

+ 3 - 0
modules/module_shop_attributes_act_delete.go

@@ -76,6 +76,9 @@ func (this *Modules) RegisterAction_ShopAttributesDelete() *Action {
 			return
 			return
 		}
 		}
 
 
+		// Delete products XML cache
+		wrap.RemoveProductXmlCacheFile()
+
 		// Reload current page
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 		wrap.Write(`window.location.reload(false);`)
 	})
 	})

+ 8 - 0
modules/module_shop_attributes_act_modify.go

@@ -89,6 +89,10 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 				wrap.MsgError(err.Error())
 				wrap.MsgError(err.Error())
 				return
 				return
 			}
 			}
+
+			// Delete products XML cache
+			wrap.RemoveProductXmlCacheFile()
+
 			wrap.Write(`window.location='/cp/shop/attributes-modify/` + utils.Int64ToStr(lastID) + `/';`)
 			wrap.Write(`window.location='/cp/shop/attributes-modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 		} else {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
@@ -215,6 +219,10 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 				wrap.MsgError(err.Error())
 				wrap.MsgError(err.Error())
 				return
 				return
 			}
 			}
+
+			// Delete products XML cache
+			wrap.RemoveProductXmlCacheFile()
+
 			wrap.Write(`window.location='/cp/shop/attributes-modify/` + pf_id + `/';`)
 			wrap.Write(`window.location='/cp/shop/attributes-modify/` + pf_id + `/';`)
 		}
 		}
 	})
 	})

+ 3 - 0
modules/module_shop_categories_act_delete.go

@@ -62,6 +62,9 @@ func (this *Modules) RegisterAction_ShopCategoriesDelete() *Action {
 			return
 			return
 		}
 		}
 
 
+		// Delete products XML cache
+		wrap.RemoveProductXmlCacheFile()
+
 		// Reload current page
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 		wrap.Write(`window.location.reload(false);`)
 	})
 	})

+ 8 - 0
modules/module_shop_categories_act_modify.go

@@ -223,12 +223,20 @@ func (this *Modules) RegisterAction_ShopCategoriesModify() *Action {
 				wrap.MsgError(err.Error())
 				wrap.MsgError(err.Error())
 				return
 				return
 			}
 			}
+
+			// Delete products XML cache
+			wrap.RemoveProductXmlCacheFile()
+
 			wrap.Write(`window.location='/cp/shop/categories-modify/` + utils.Int64ToStr(lastID) + `/';`)
 			wrap.Write(`window.location='/cp/shop/categories-modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 		} else {
 			if err := this.shop_ActionCategoryUpdate(wrap, pf_id, pf_name, pf_alias, pf_parent); err != nil {
 			if err := this.shop_ActionCategoryUpdate(wrap, pf_id, pf_name, pf_alias, pf_parent); err != nil {
 				wrap.MsgError(err.Error())
 				wrap.MsgError(err.Error())
 				return
 				return
 			}
 			}
+
+			// Delete products XML cache
+			wrap.RemoveProductXmlCacheFile()
+
 			wrap.Write(`window.location='/cp/shop/categories-modify/` + pf_id + `/';`)
 			wrap.Write(`window.location='/cp/shop/categories-modify/` + pf_id + `/';`)
 		}
 		}
 	})
 	})

+ 3 - 0
modules/module_shop_currencies_act_delete.go

@@ -34,6 +34,9 @@ func (this *Modules) RegisterAction_ShopCurrenciesDelete() *Action {
 			return
 			return
 		}
 		}
 
 
+		// Delete products XML cache
+		wrap.RemoveProductXmlCacheFile()
+
 		// Reload current page
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 		wrap.Write(`window.location.reload(false);`)
 	})
 	})

+ 8 - 0
modules/module_shop_currencies_act_modify.go

@@ -73,6 +73,10 @@ func (this *Modules) RegisterAction_ShopCurrenciesModify() *Action {
 				wrap.MsgError(err.Error())
 				wrap.MsgError(err.Error())
 				return
 				return
 			}
 			}
+
+			// Delete products XML cache
+			wrap.RemoveProductXmlCacheFile()
+
 			wrap.Write(`window.location='/cp/shop/currencies-modify/` + utils.Int64ToStr(lastID) + `/';`)
 			wrap.Write(`window.location='/cp/shop/currencies-modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 		} else {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
@@ -104,6 +108,10 @@ func (this *Modules) RegisterAction_ShopCurrenciesModify() *Action {
 				wrap.MsgError(err.Error())
 				wrap.MsgError(err.Error())
 				return
 				return
 			}
 			}
+
+			// Delete products XML cache
+			wrap.RemoveProductXmlCacheFile()
+
 			wrap.Write(`window.location='/cp/shop/currencies-modify/` + pf_id + `/';`)
 			wrap.Write(`window.location='/cp/shop/currencies-modify/` + pf_id + `/';`)
 		}
 		}
 	})
 	})