From ac2578d1fc00623029b331b7d0e7ffcdc2c6b390 Mon Sep 17 00:00:00 2001 From: merdan Date: Sun, 25 Sep 2022 22:24:33 +0500 Subject: [PATCH] cat bug fix --- controllers/ImportController.go | 4 ++-- gorm_models/brand.go | 4 ++-- gorm_models/product.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/ImportController.go b/controllers/ImportController.go index cb62bda..c849d80 100644 --- a/controllers/ImportController.go +++ b/controllers/ImportController.go @@ -211,8 +211,8 @@ func getTotalDocumentCount(db string) int { // todo defailt variant // productflat -func getCats(db *gorm.DB, catIDs []int) ([3]gm.Category, string, error) { - var categories [3]gm.Category +func getCats(db *gorm.DB, catIDs []int) ([]gm.Category, string, error) { + var categories []gm.Category var keywords string if errCat := db.Preload("Translations").Find(&categories, catIDs).Error; errCat != nil { diff --git a/gorm_models/brand.go b/gorm_models/brand.go index 1fde404..7f03085 100644 --- a/gorm_models/brand.go +++ b/gorm_models/brand.go @@ -15,10 +15,10 @@ type Brand struct { Name string `gorm:"default:TESTBRAND"` Code string Status bool - Categories [3]Category `gorm:"many2many:category_brands;"` + Categories []Category `gorm:"many2many:category_brands;"` } -func FindOrCreateBrand(db *gorm.DB, brand string, categories [3]Category) (Brand, error) { +func FindOrCreateBrand(db *gorm.DB, brand string, categories []Category) (Brand, error) { var brandObject Brand diff --git a/gorm_models/product.go b/gorm_models/product.go index bb3319f..1cea3b5 100644 --- a/gorm_models/product.go +++ b/gorm_models/product.go @@ -20,7 +20,7 @@ type Product struct { BrandID uint `sql:"DEFAULT:NULL"` Brand Brand Images []ProductImage - Categories [3]Category `gorm:"many2many:product_categories;"` + Categories []Category `gorm:"many2many:product_categories;"` AttributeValues []ProductAttributeValue SuperAttributes []Attribute `gorm:"many2many:product_super_attributes;"` }