Browse Source

Don't remove product images on SQL error

Vova Tkach 5 years ago
parent
commit
c3f14fa1d8
1 changed files with 2 additions and 1 deletions
  1. 2 1
      modules/module_shop_act_delete.go

+ 2 - 1
modules/module_shop_act_delete.go

@@ -37,7 +37,6 @@ func (this *Modules) RegisterAction_ShopDelete() *Action {
 			if _, err := tx.Exec("DELETE FROM shop_product_images WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			wrap.RemoveProductImageThumbnails(pf_id, "*")
 
 			// Delete target product with category connection data
 			if _, err := tx.Exec("DELETE FROM shop_filter_product_values WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
@@ -55,6 +54,8 @@ func (this *Modules) RegisterAction_ShopDelete() *Action {
 			return
 		}
 
+		wrap.RemoveProductImageThumbnails(pf_id, "*")
+
 		wrap.RecreateProductXmlFile()
 
 		wrap.ResetCacheBlocks()