shimdilik importy disable yapiom ben
This commit is contained in:
parent
3872eeca33
commit
ffeb9f87d1
|
|
@ -143,10 +143,19 @@ func (importer *Importer) UpdateOrCreate(product models.Product) (instance *Impo
|
|||
var (
|
||||
//variant *gm.Product
|
||||
variantFlat *gm.ProductFlat
|
||||
err error
|
||||
//err error
|
||||
)
|
||||
|
||||
err = importer.Baza.Preload("Product").Preload("Variants").First(&variantFlat, "sku = ?", colorVariant.ProductNumber).Error
|
||||
if importer.Baza.Preload("Product").Preload("Variants").First(&variantFlat, "sku = ?", colorVariant.ProductNumber).Error == nil {
|
||||
if !colorVariant.IsSellable {
|
||||
importer.disableVariant(*variantFlat)
|
||||
linkedProducts = append(linkedProducts, variantFlat.Product)
|
||||
|
||||
} else {
|
||||
importer.updateVariant(colorVariant, *variantFlat)
|
||||
linkedProducts = append(linkedProducts, variantFlat.Product)
|
||||
}
|
||||
}
|
||||
|
||||
//if err != nil && errors.Is(err, gorm.ErrRecordNotFound) && colorVariant.IsSellable {
|
||||
// if variant, err = importer.importVariant(colorVariant); err == nil {
|
||||
|
|
@ -155,15 +164,6 @@ func (importer *Importer) UpdateOrCreate(product models.Product) (instance *Impo
|
|||
//
|
||||
//} else
|
||||
|
||||
if err == nil && !colorVariant.IsSellable {
|
||||
importer.disableVariant(*variantFlat)
|
||||
linkedProducts = append(linkedProducts, variantFlat.Product)
|
||||
|
||||
} else {
|
||||
importer.updateVariant(colorVariant, *variantFlat)
|
||||
linkedProducts = append(linkedProducts, variantFlat.Product)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if len(newProducts) > 0 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue