This commit is contained in:
merdan 2022-09-25 21:47:16 +05:00
parent 08c4e79836
commit ba6a042174
2 changed files with 5 additions and 3 deletions

View File

@ -249,15 +249,17 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
tx := *db.Begin() tx := *db.Begin()
categories, keywords, errCat := getCats(&tx, product.Categories) categories, keywords, errCat := getCats(&tx, product.Categories)
log.Println(categories)
if errCat != nil { if errCat != nil {
log.Println("ERR0001" + errCat.Error()) log.Println("ERR0 Categories" + errCat.Error())
tx.Rollback()
return errCat return errCat
} }
brand, err := gm.FindOrCreateBrand(&tx, product.Brand, categories) brand, err := gm.FindOrCreateBrand(&tx, product.Brand, categories)
if err != nil { if err != nil {
tx.Rollback() tx.Rollback()
log.Println(err) log.Println("ERR BRAND" + err.Error())
return err return err
} }

View File

@ -10,7 +10,7 @@ type AttributeOption struct {
ID uint `gorm:"primaryKey"` ID uint `gorm:"primaryKey"`
AttributeID uint AttributeID uint
AdminName string AdminName string
Position int SortOrder int `sql:"DEFAULT:NULL" gorm:"default:null"`
} }
type Attribute struct { type Attribute struct {