From ba6a04217437f6c58e468b7883398dbb819c8cc8 Mon Sep 17 00:00:00 2001 From: merdan Date: Sun, 25 Sep 2022 21:47:16 +0500 Subject: [PATCH] fix --- controllers/ImportController.go | 6 ++++-- gorm_models/family.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/controllers/ImportController.go b/controllers/ImportController.go index 322bfdc..7af75db 100644 --- a/controllers/ImportController.go +++ b/controllers/ImportController.go @@ -249,15 +249,17 @@ func ImportProduct(product models.Product, db *gorm.DB) error { tx := *db.Begin() categories, keywords, errCat := getCats(&tx, product.Categories) + log.Println(categories) if errCat != nil { - log.Println("ERR0001" + errCat.Error()) + log.Println("ERR0 Categories" + errCat.Error()) + tx.Rollback() return errCat } brand, err := gm.FindOrCreateBrand(&tx, product.Brand, categories) if err != nil { tx.Rollback() - log.Println(err) + log.Println("ERR BRAND" + err.Error()) return err } diff --git a/gorm_models/family.go b/gorm_models/family.go index 5e1b279..82f971d 100644 --- a/gorm_models/family.go +++ b/gorm_models/family.go @@ -10,7 +10,7 @@ type AttributeOption struct { ID uint `gorm:"primaryKey"` AttributeID uint AdminName string - Position int + SortOrder int `sql:"DEFAULT:NULL" gorm:"default:null"` } type Attribute struct {