shimdilik importy disable yapiom ben
This commit is contained in:
parent
3872eeca33
commit
ffeb9f87d1
|
|
@ -143,19 +143,11 @@ 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 err != nil && errors.Is(err, gorm.ErrRecordNotFound) && colorVariant.IsSellable {
|
||||
// if variant, err = importer.importVariant(colorVariant); err == nil {
|
||||
// newProducts = append(newProducts, *variant)
|
||||
// }
|
||||
//
|
||||
//} else
|
||||
|
||||
if err == nil && !colorVariant.IsSellable {
|
||||
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)
|
||||
|
||||
|
|
@ -163,6 +155,14 @@ func (importer *Importer) UpdateOrCreate(product models.Product) (instance *Impo
|
|||
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 {
|
||||
// newProducts = append(newProducts, *variant)
|
||||
// }
|
||||
//
|
||||
//} else
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue