kategoria tekst
This commit is contained in:
parent
5bb2e790e3
commit
ef80350463
|
|
@ -344,8 +344,6 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
|
||||
colorOption := gm.GetAttributeOption(db, AttributesMap["color"].ID, colorVariant.Color)
|
||||
|
||||
colorSavePoint := "ColorSavePoint" + strconv.Itoa(colorIndex)
|
||||
|
||||
if len(colorVariant.SizeVariants) > 0 {
|
||||
|
||||
for index, sizeVariant := range colorVariant.SizeVariants {
|
||||
|
|
@ -356,6 +354,10 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
|
||||
tx.SavePoint(savePoint)
|
||||
|
||||
if sizeVariant.ItemNumber == 0 {
|
||||
sizeVariant.ItemNumber = index
|
||||
}
|
||||
|
||||
sku := fmt.Sprintf("%s-%s-%d-col-size", colorVariant.ProductGroupID, colorVariant.ProductNumber, sizeVariant.ItemNumber)
|
||||
|
||||
productVariant := gm.Product{
|
||||
|
|
@ -464,7 +466,7 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
|
|||
}
|
||||
|
||||
} else {
|
||||
|
||||
colorSavePoint := "ColorSavePoint" + strconv.Itoa(colorIndex)
|
||||
colorOption := gm.GetAttributeOption(db, AttributesMap["color"].ID, colorVariant.Color)
|
||||
attributes, variantFlat := collectAttributes(&colorVariant, &colorOption)
|
||||
attributes = append(attributes, gm.ProductAttributeValue{AttributeID: AttributesMap["meta_keywords"].ID, TextValue: keywords, Channel: "default", Locale: "tm"})
|
||||
|
|
@ -494,7 +496,8 @@ 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("ERR55" + errProdVariant.Error())
|
||||
tx.RollbackTo(colorSavePoint)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue