shimdilik importy disable yapiom ben
This commit is contained in:
parent
cbbf952748
commit
109e8ec19b
2
main.go
2
main.go
|
|
@ -111,7 +111,7 @@ func worker(db *gorm.DB, stopCh <-chan struct{}, updatePeriod time.Duration) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the product in the database
|
// Update the product in the database
|
||||||
if importer.UpdateOrCreate(jsonProduct, product.ProductID).Error != nil {
|
if importer.UpdateOrCreate(jsonProduct).Error != nil {
|
||||||
log.Println("Error updateing product information:", err)
|
log.Println("Error updateing product information:", err)
|
||||||
importer.Error = nil
|
importer.Error = nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,72 +111,77 @@ func ParseImporterInstance(db *gorm.DB) (instance *Importer, err error) {
|
||||||
return instance, nil
|
return instance, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (importer *Importer) UpdateOrCreate(product models.Product, product_id uint) (instance *Importer) {
|
func (importer *Importer) UpdateOrCreate(product models.Product) (instance *Importer) {
|
||||||
|
|
||||||
var firstProduct *gm.Product
|
//var newProducts []gm.Product
|
||||||
var newProducts []gm.Product
|
var firstProductFlat *gm.ProductFlat
|
||||||
|
err := importer.Baza.Preload("Product").Preload("Variants").First(&firstProductFlat, "sku = ?", product.ProductNumber).Error
|
||||||
//haryt satuwdan ayrlan bolsa bagistoda disable et
|
//haryt satuwdan ayrlan bolsa bagistoda disable et
|
||||||
if !product.IsSellable {
|
|
||||||
if firstProduct = importer.disableVariant(product, product_id); firstProduct == nil {
|
if err == nil {
|
||||||
//disable edende error doran bolsa dowam etme
|
if !product.IsSellable {
|
||||||
return importer
|
importer.disableVariant(*firstProductFlat)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
importer.updateVariant(product, *firstProductFlat)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if firstProduct, _ = importer.updateVariant(product, product_id); firstProduct == nil {
|
|
||||||
return importer
|
|
||||||
}
|
|
||||||
|
|
||||||
if &firstProduct != nil {
|
|
||||||
newProducts = append(newProducts, *firstProduct)
|
|
||||||
}
|
}
|
||||||
|
//else if err != nil && errors.Is(err, gorm.ErrRecordNotFound){
|
||||||
|
// if firstProduct, err := importer.importVariant(product); err !=nil{
|
||||||
|
// newProducts = append(newProducts, *firstProduct)
|
||||||
|
// firstProductFlat = &gm.ProductFlat{}
|
||||||
|
// firstProductFlat.Product = *firstProduct
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
if product.ColorVariants != nil && len(*product.ColorVariants) > 0 {
|
if product.ColorVariants != nil && len(*product.ColorVariants) > 0 {
|
||||||
linkedProducts := []gm.Product{*firstProduct}
|
|
||||||
|
|
||||||
|
linkedProducts := []gm.Product{firstProductFlat.Product}
|
||||||
for _, colorVariant := range *product.ColorVariants {
|
for _, colorVariant := range *product.ColorVariants {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
variant *gm.Product
|
//variant *gm.Product
|
||||||
variantFlat *gm.ProductFlat
|
variantFlat *gm.ProductFlat
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
err = importer.Baza.Preload("Product").Preload("Variants").First(&variantFlat, "sku = ?", colorVariant.ProductNumber).Error
|
err = importer.Baza.Preload("Product").Preload("Variants").First(&variantFlat, "sku = ?", colorVariant.ProductNumber).Error
|
||||||
|
|
||||||
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) && colorVariant.IsSellable {
|
//if err != nil && errors.Is(err, gorm.ErrRecordNotFound) && colorVariant.IsSellable {
|
||||||
if variant, err = importer.importVariant(colorVariant); err == nil {
|
// if variant, err = importer.importVariant(colorVariant); err == nil {
|
||||||
newProducts = append(newProducts, *variant)
|
// newProducts = append(newProducts, *variant)
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//} else
|
||||||
|
|
||||||
} else if err == nil && !colorVariant.IsSellable {
|
if err == nil && !colorVariant.IsSellable {
|
||||||
variant = importer.disableVariant(colorVariant, variantFlat.ProductID)
|
importer.disableVariant(*variantFlat)
|
||||||
linkedProducts = append(linkedProducts, *variant)
|
linkedProducts = append(linkedProducts, variantFlat.Product)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if variant, importer.Error = importer.updateVariant(colorVariant, variantFlat.ProductID); importer.Error != nil {
|
importer.updateVariant(colorVariant, *variantFlat)
|
||||||
return importer
|
linkedProducts = append(linkedProducts, variantFlat.Product)
|
||||||
}
|
|
||||||
linkedProducts = append(linkedProducts, *variant)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(newProducts) > 0 {
|
//if len(newProducts) > 0 {
|
||||||
// relation
|
// // relation
|
||||||
|
//
|
||||||
var relation []gm.ProductRelation
|
// var relation []gm.ProductRelation
|
||||||
for _, linkedProduct := range linkedProducts {
|
// for _, linkedProduct := range linkedProducts {
|
||||||
|
//
|
||||||
for _, newProd := range newProducts {
|
// for _, newProd := range newProducts {
|
||||||
relation = append(relation, gm.ProductRelation{ParentID: linkedProduct.ID, ChildID: newProd.ID})
|
// relation = append(relation, gm.ProductRelation{ParentID: linkedProduct.ID, ChildID: newProd.ID})
|
||||||
relation = append(relation, gm.ProductRelation{ParentID: newProd.ID, ChildID: linkedProduct.ID})
|
// relation = append(relation, gm.ProductRelation{ParentID: newProd.ID, ChildID: linkedProduct.ID})
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if err := importer.Baza.Create(&relation).Error; err != nil {
|
// if err := importer.Baza.Create(&relation).Error; err != nil {
|
||||||
log.Println(err)
|
// log.Println(err)
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
return importer
|
return importer
|
||||||
|
|
@ -184,12 +189,6 @@ func (importer *Importer) UpdateOrCreate(product models.Product, product_id uint
|
||||||
|
|
||||||
func (importer *Importer) importVariant(product models.Product) (*gm.Product, error) {
|
func (importer *Importer) importVariant(product models.Product) (*gm.Product, error) {
|
||||||
|
|
||||||
// check if wishlisted then update if.
|
|
||||||
//if _, ok := importer.wishlist[product.ProductNumber]; ok {
|
|
||||||
// delete(importer.wishlist,product.ProductNumber)
|
|
||||||
// return importer.updateVariant(product)
|
|
||||||
//}
|
|
||||||
|
|
||||||
productRepo := InitProductRepo(&product, importer.GetColorOption(product.Color), importer.GetSexOption(product.Cinsiyet))
|
productRepo := InitProductRepo(&product, importer.GetColorOption(product.Color), importer.GetSexOption(product.Cinsiyet))
|
||||||
|
|
||||||
if categories, err := gm.GetCatKeywords(importer.Baza, product.Categories); err != nil {
|
if categories, err := gm.GetCatKeywords(importer.Baza, product.Categories); err != nil {
|
||||||
|
|
@ -210,7 +209,7 @@ func (importer *Importer) importVariant(product models.Product) (*gm.Product, er
|
||||||
tx := importer.Baza.Begin()
|
tx := importer.Baza.Begin()
|
||||||
|
|
||||||
if err := tx.Omit("Categories.*", "SuperAttributes.*", "ParentID").Create(&mainPorduct).Error; err != nil {
|
if err := tx.Omit("Categories.*", "SuperAttributes.*", "ParentID").Create(&mainPorduct).Error; err != nil {
|
||||||
tx.Rollback()
|
tx.Commit()
|
||||||
log.Println(err, "er1")
|
log.Println(err, "er1")
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
||||||
|
|
@ -423,44 +422,42 @@ func (importer *Importer) GetSexOption(optionName string) gm.AttributeOption {
|
||||||
return option
|
return option
|
||||||
}
|
}
|
||||||
|
|
||||||
func (importer *Importer) disableVariant(product models.Product, product_id uint) *gm.Product {
|
func (importer *Importer) disableVariant(productFlat gm.ProductFlat) {
|
||||||
var flat gm.ProductFlat
|
|
||||||
importer.Error = importer.Baza.Preload("Product").Preload("Variants").
|
|
||||||
First(&flat, "product_id = ?", product_id).Error
|
|
||||||
|
|
||||||
if importer.Error != nil {
|
importer.Error = importer.Baza.Model(&productFlat).Update("status", false).Error
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
importer.Error = importer.Baza.Model(&flat).Update("status", false).Error
|
|
||||||
|
|
||||||
importer.Error = importer.Baza.Model(&gm.ProductAttributeValue{}).
|
importer.Error = importer.Baza.Model(&gm.ProductAttributeValue{}).
|
||||||
Where("attribute_id=8 AND product_id=?", flat.ProductID).
|
Where("attribute_id=8 AND product_id=?", productFlat.ProductID).
|
||||||
Update("boolean_value", false).Error
|
Update("boolean_value", false).Error
|
||||||
|
|
||||||
return &flat.Product
|
if importer.Error != nil {
|
||||||
|
log.Println(importer.Error)
|
||||||
|
importer.Error = nil
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (importer *Importer) updateVariant(product models.Product, product_id uint) (*gm.Product, error) {
|
func (importer *Importer) enableVariant(productFlat gm.ProductFlat) {
|
||||||
|
importer.Error = importer.Baza.Model(&productFlat).Update("status", true).Error
|
||||||
|
|
||||||
var flat gm.ProductFlat
|
importer.Error = importer.Baza.Model(&gm.ProductAttributeValue{}).
|
||||||
|
Where("attribute_id=8 AND product_id=?", productFlat.ProductID).
|
||||||
importer.Error = importer.Baza.Preload("Product").Preload("Variants").First(&flat, "product_id = ?", product_id).Error
|
Update("boolean_value", true).Error
|
||||||
|
|
||||||
if importer.Error != nil {
|
if importer.Error != nil {
|
||||||
if errors.Is(importer.Error, gorm.ErrRecordNotFound) {
|
log.Println(importer.Error)
|
||||||
return importer.importVariant(product)
|
importer.Error = nil
|
||||||
}
|
|
||||||
//todo not found bolsa create etmeli
|
|
||||||
return nil, importer.Error
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (importer *Importer) updateVariant(product models.Product, flat gm.ProductFlat) {
|
||||||
|
|
||||||
if flat.Product.Type == "configurable" {
|
if flat.Product.Type == "configurable" {
|
||||||
|
|
||||||
productRepo := InitProductRepo(&product, importer.GetColorOption(product.Color), importer.GetSexOption(product.Cinsiyet))
|
productRepo := InitProductRepo(&product, importer.GetColorOption(product.Color), importer.GetSexOption(product.Cinsiyet))
|
||||||
if brand, err := gm.FindOrCreateBrand(importer.Baza, product.Brand, productRepo.Categories); err != nil {
|
if brand, err := gm.FindOrCreateBrand(importer.Baza, product.Brand, productRepo.Categories); err != nil {
|
||||||
return nil, err
|
log.Println(err)
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
productRepo.Brand = brand
|
productRepo.Brand = brand
|
||||||
}
|
}
|
||||||
|
|
@ -473,16 +470,13 @@ func (importer *Importer) updateVariant(product models.Product, product_id uint)
|
||||||
if variant.AttributeValue == flatVariant.BoyutLabel || variant.AttributeValue == flatVariant.SizeLabel {
|
if variant.AttributeValue == flatVariant.BoyutLabel || variant.AttributeValue == flatVariant.SizeLabel {
|
||||||
|
|
||||||
if !variant.Sellable {
|
if !variant.Sellable {
|
||||||
importer.Baza.Model(&flatVariant).Update("status", false)
|
importer.disableVariant(flatVariant)
|
||||||
importer.Baza.Model(&gm.ProductAttributeValue{}).Where("attribute_id=8 AND product_id=?", flatVariant.ProductID).Update("boolean_value", false)
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
importer.updatePrice(variant.Price, &flatVariant)
|
importer.updatePrice(variant.Price, &flatVariant)
|
||||||
|
|
||||||
if !flatVariant.Status {
|
if !flatVariant.Status {
|
||||||
|
importer.enableVariant(flatVariant)
|
||||||
importer.Baza.Model(&flatVariant).Update("status", true)
|
|
||||||
importer.Baza.Model(&gm.ProductAttributeValue{}).Where("attribute_id=8 AND product_id=?", flatVariant.ProductID).Update("boolean_value", true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
found = true
|
found = true
|
||||||
|
|
@ -524,11 +518,9 @@ func (importer *Importer) updateVariant(product models.Product, product_id uint)
|
||||||
importer.Baza.Omit("ParentID", "CreatedAt", "Variants", "SpecialPrice").Save(&flat)
|
importer.Baza.Omit("ParentID", "CreatedAt", "Variants", "SpecialPrice").Save(&flat)
|
||||||
|
|
||||||
} else { //simple
|
} else { //simple
|
||||||
|
|
||||||
importer.updatePrice(product.Price, &flat)
|
importer.updatePrice(product.Price, &flat)
|
||||||
|
|
||||||
}
|
}
|
||||||
return &flat.Product, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (importer *Importer) updatePrice(price models.Price, flat *gm.ProductFlat) {
|
func (importer *Importer) updatePrice(price models.Price, flat *gm.ProductFlat) {
|
||||||
|
|
@ -565,195 +557,3 @@ func (importer *Importer) updatePrice(price models.Price, flat *gm.ProductFlat)
|
||||||
Delete(&gm.ProductAttributeValue{})
|
Delete(&gm.ProductAttributeValue{})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (importer *Importer) importParsedVariant(product models.Product) (gm.Product, error) {
|
|
||||||
|
|
||||||
//todo search if exists
|
|
||||||
|
|
||||||
productRepo := InitProductRepo(&product, importer.GetColorOption(product.Color), importer.GetSexOption(product.Cinsiyet))
|
|
||||||
productRepo.ImageType = "lcw"
|
|
||||||
if brand, err := gm.FindOrCreateBrand(importer.Baza, product.Brand, productRepo.Categories); err != nil {
|
|
||||||
return gm.Product{}, err
|
|
||||||
} else {
|
|
||||||
productRepo.Brand = brand
|
|
||||||
}
|
|
||||||
mainPorduct := productRepo.makeProduct(importer)
|
|
||||||
|
|
||||||
//BEGIN TRANSACTION
|
|
||||||
tx := importer.Baza.Begin()
|
|
||||||
|
|
||||||
if err := tx.Omit("Categories", "SuperAttributes.*", "ParentID").Create(&mainPorduct).Error; err != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
return gm.Product{}, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
mainFlat := productRepo.makeProductFlat(mainPorduct.ID)
|
|
||||||
|
|
||||||
if err := tx.Create(&mainFlat).Error; err != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
return gm.Product{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if productRepo.HasSizeVariants() {
|
|
||||||
var sizeVariants []gm.ProductFlat
|
|
||||||
for index, variant := range *product.SizeVariants {
|
|
||||||
if !variant.Sellable {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
savePoint := "size" + strconv.Itoa(index)
|
|
||||||
tx.SavePoint(savePoint)
|
|
||||||
|
|
||||||
var sizeOPtion gm.AttributeOption
|
|
||||||
|
|
||||||
if variant.AttributeName == "Beden" {
|
|
||||||
sizeOPtion = gm.GetAttributeOption(tx, importer.AttributesMap["size"].ID, variant.AttributeValue)
|
|
||||||
} else {
|
|
||||||
sizeOPtion = gm.GetAttributeOption(tx, importer.AttributesMap["boyut"].ID, variant.AttributeValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
sku := fmt.Sprintf("%s-%d", product.ProductNumber, variant.ItemNumber)
|
|
||||||
log.Println(sku)
|
|
||||||
log.Println(variant)
|
|
||||||
|
|
||||||
variantProduct := productRepo.makeVariant(mainPorduct.ID, mainPorduct.AttributeFamilyID, sku)
|
|
||||||
|
|
||||||
variantProduct.AttributeValues = productRepo.getVariantAttributes(importer.AttributesMap, &variant, sizeOPtion.ID)
|
|
||||||
|
|
||||||
if err := tx.Omit("Categories.*").Create(&variantProduct).Error; err != nil {
|
|
||||||
log.Println("Variant Product Create Error: " + err.Error())
|
|
||||||
tx.RollbackTo(savePoint)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
variantFlat := productRepo.makeVariantFlat(variant, sizeOPtion.ID, mainFlat.ID, variantProduct.ID)
|
|
||||||
|
|
||||||
if err := tx.Create(&variantFlat).Error; err != nil {
|
|
||||||
log.Println("Variant Flat Create Error: " + err.Error())
|
|
||||||
tx.RollbackTo(savePoint)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
sizeVariants = append(sizeVariants, variantFlat)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(sizeVariants) == 0 {
|
|
||||||
tx.Rollback()
|
|
||||||
return gm.Product{}, errors.New("siz variantlary yok bolsa main productam girayenok")
|
|
||||||
} else {
|
|
||||||
calcPrice(sizeVariants, &mainFlat)
|
|
||||||
|
|
||||||
err := tx.Omit("ParentID", "CreatedAt", "Variants", "SpecialPrice").Save(&mainFlat).Error
|
|
||||||
|
|
||||||
mainFlat.Variants = sizeVariants
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
return gm.Product{}, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Println(product.Vendor)
|
|
||||||
|
|
||||||
sProduct := importer.createSellerProduct(&mainFlat, product.Vendor)
|
|
||||||
|
|
||||||
if errSProduct := tx.Create(&sProduct).Error; errSProduct != nil {
|
|
||||||
tx.Rollback()
|
|
||||||
return gm.Product{}, errSProduct
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := tx.Commit().Error; err != nil {
|
|
||||||
return gm.Product{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return mainPorduct, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (importer *Importer) updateParsedVariant(product models.Product) (gm.Product, error) {
|
|
||||||
var flat gm.ProductFlat
|
|
||||||
err := importer.Baza.Preload("Product").Preload("Variants").First(&flat, "sku = ?", product.ProductNumber).Error
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
return importer.importParsedVariant(product)
|
|
||||||
}
|
|
||||||
//todo not found bolsa create etmeli
|
|
||||||
return gm.Product{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if flat.Product.Type == "configurable" {
|
|
||||||
|
|
||||||
productRepo := InitProductRepo(&product, importer.GetColorOption(product.Color), importer.GetSexOption(product.Cinsiyet))
|
|
||||||
productRepo.ImageType = "lcw"
|
|
||||||
if brand, err := gm.FindOrCreateBrand(importer.Baza, product.Brand, productRepo.Categories); err != nil {
|
|
||||||
return gm.Product{}, err
|
|
||||||
} else {
|
|
||||||
productRepo.Brand = brand
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, variant := range *product.SizeVariants {
|
|
||||||
|
|
||||||
found := false
|
|
||||||
for _, flatVariant := range flat.Variants {
|
|
||||||
|
|
||||||
if variant.AttributeValue == flatVariant.BoyutLabel || variant.AttributeValue == flatVariant.SizeLabel {
|
|
||||||
|
|
||||||
if !variant.Sellable {
|
|
||||||
importer.Baza.Model(&flatVariant).Update("status", false)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
importer.updatePrice(variant.Price, &flatVariant)
|
|
||||||
|
|
||||||
if !flatVariant.Status {
|
|
||||||
|
|
||||||
importer.Baza.Model(&flatVariant).Update("status", true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
found = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if variant.Sellable && !found {
|
|
||||||
// insert variant
|
|
||||||
var sizeOPtion gm.AttributeOption
|
|
||||||
|
|
||||||
if variant.AttributeName == "Beden" {
|
|
||||||
sizeOPtion = gm.GetAttributeOption(importer.Baza, importer.AttributesMap["size"].ID, variant.AttributeValue)
|
|
||||||
} else {
|
|
||||||
sizeOPtion = gm.GetAttributeOption(importer.Baza, importer.AttributesMap["boyut"].ID, variant.AttributeValue)
|
|
||||||
}
|
|
||||||
log.Println(variant)
|
|
||||||
sku := fmt.Sprintf("%s-%d", product.ProductNumber, variant.ItemNumber)
|
|
||||||
log.Println(sku)
|
|
||||||
|
|
||||||
variantProduct := productRepo.makeVariant(flat.ProductID, flat.Product.AttributeFamilyID, sku)
|
|
||||||
|
|
||||||
variantProduct.AttributeValues = productRepo.getVariantAttributes(importer.AttributesMap, &variant, sizeOPtion.ID)
|
|
||||||
|
|
||||||
if err := importer.Baza.Omit("Categories").Create(&variantProduct).Error; err != nil {
|
|
||||||
log.Println("Variant Product Create Error: " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
variantFlat := productRepo.makeVariantFlat(variant, sizeOPtion.ID, flat.ID, variantProduct.ID)
|
|
||||||
|
|
||||||
if err := importer.Baza.Create(&variantFlat).Error; err != nil {
|
|
||||||
log.Println("Variant Flat Create Error: " + err.Error())
|
|
||||||
|
|
||||||
}
|
|
||||||
flat.Variants = append(flat.Variants, variantFlat)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
calcPrice(flat.Variants, &flat)
|
|
||||||
importer.Baza.Omit("ParentID", "CreatedAt", "Variants", "SpecialPrice").Save(&flat)
|
|
||||||
|
|
||||||
} else { //simple
|
|
||||||
|
|
||||||
importer.updatePrice(product.Price, &flat)
|
|
||||||
|
|
||||||
}
|
|
||||||
return flat.Product, nil
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue