kategoria tekst
This commit is contained in:
parent
63591d6628
commit
979a41e13e
|
|
@ -247,8 +247,10 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
categories, keywords, errCat := getCats(db, product.Categories)
|
||||
|
||||
if errCat != nil {
|
||||
//log.Println("ERR0001"+errCat.Error())
|
||||
log.Println("ERR0001" + errCat.Error())
|
||||
return errCat
|
||||
} else {
|
||||
log.Println(categories)
|
||||
}
|
||||
|
||||
var brand gm.Brand
|
||||
|
|
@ -311,7 +313,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
tx := db.Begin()
|
||||
|
||||
if errMainProduct := tx.Omit("Categories.*", "SuperAttributes.*", "ParentID").Create(&iproduct).Error; errMainProduct != nil {
|
||||
//log.Println("ERR1" + errMainProduct.Error())
|
||||
log.Println("ERR1" + errMainProduct.Error())
|
||||
tx.Rollback()
|
||||
return errMainProduct
|
||||
}
|
||||
|
|
@ -322,7 +324,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
|
||||
if errProductMainFlat := tx.Create(&mainProductFlat).Error; errProductMainFlat != nil {
|
||||
tx.Rollback()
|
||||
//log.Println("ERR2" + errProductMainFlat.Error())
|
||||
log.Println("ERR2" + errProductMainFlat.Error())
|
||||
return errProductMainFlat
|
||||
}
|
||||
|
||||
|
|
@ -362,7 +364,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
}
|
||||
|
||||
if errProdVariant := tx.Omit("Categories.*").Create(&productVariant).Error; errProdVariant != nil {
|
||||
//log.Println("ERR3" + errProdVariant.Error())
|
||||
log.Println("ERR3" + errProdVariant.Error())
|
||||
tx.RollbackTo(savePoint)
|
||||
continue
|
||||
}
|
||||
|
|
@ -429,7 +431,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
|
||||
if attError := tx.Create(&attributes).Error; attError != nil {
|
||||
tx.RollbackTo(savePoint)
|
||||
//log.Println("ERR4" + attError.Error())
|
||||
log.Println("ERR4" + attError.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
@ -442,7 +444,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
}
|
||||
|
||||
if errVariant := tx.Create(&flatVariant).Error; errVariant != nil {
|
||||
//log.Println("ERR5" + errVariant.Error())
|
||||
log.Println("ERR5" + errVariant.Error())
|
||||
tx.RollbackTo(savePoint)
|
||||
continue
|
||||
}
|
||||
|
|
@ -482,7 +484,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
}
|
||||
|
||||
if errProdVariant := tx.Omit("Categories.*").Create(&productVariant).Error; errProdVariant != nil {
|
||||
//log.Println("ERR5" + errProdVariant.Error())
|
||||
log.Println("ERR5" + errProdVariant.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
@ -493,7 +495,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
variantFlat.ParentID = mainProductFlat.ID
|
||||
|
||||
if errVariant := tx.Create(&variantFlat).Error; errVariant != nil {
|
||||
//log.Println("ERR6" + errVariant.Error())
|
||||
log.Println("ERR6" + errVariant.Error())
|
||||
tx.RollbackTo(colorSavePoint)
|
||||
continue
|
||||
}
|
||||
|
|
@ -601,14 +603,14 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
}
|
||||
|
||||
if errSizeVar := tx.Omit("Categories.*").Create(&sizeVariantProduct).Error; errSizeVar != nil {
|
||||
//log.Println("ERR7" + errSizeVar.Error())
|
||||
log.Println("ERR7" + errSizeVar.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
flatVariant.ProductID = sizeVariantProduct.ID
|
||||
|
||||
if errVariant := tx.Create(&flatVariant).Error; errVariant != nil {
|
||||
//log.Println("ERR8" + errVariant.Error())
|
||||
log.Println("ERR8" + errVariant.Error())
|
||||
tx.RollbackTo(sizeSavePoint)
|
||||
continue
|
||||
}
|
||||
|
|
@ -630,7 +632,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
}
|
||||
|
||||
if errFlat != nil {
|
||||
//log.Println("ERR9" + errFlat.Error())
|
||||
log.Println("ERR9" + errFlat.Error())
|
||||
tx.Rollback()
|
||||
return errFlat
|
||||
}
|
||||
|
|
@ -640,7 +642,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
errSProduct := tx.Create(&sProduct).Error
|
||||
|
||||
if errSProduct != nil {
|
||||
//log.Println("ERR10" + errSProduct.Error())
|
||||
log.Println("ERR10" + errSProduct.Error())
|
||||
tx.Rollback()
|
||||
return errSProduct
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue