cat bug fix
This commit is contained in:
parent
4732a0ce84
commit
ac2578d1fc
|
|
@ -211,8 +211,8 @@ func getTotalDocumentCount(db string) int {
|
||||||
// todo defailt variant
|
// todo defailt variant
|
||||||
// productflat
|
// productflat
|
||||||
|
|
||||||
func getCats(db *gorm.DB, catIDs []int) ([3]gm.Category, string, error) {
|
func getCats(db *gorm.DB, catIDs []int) ([]gm.Category, string, error) {
|
||||||
var categories [3]gm.Category
|
var categories []gm.Category
|
||||||
var keywords string
|
var keywords string
|
||||||
|
|
||||||
if errCat := db.Preload("Translations").Find(&categories, catIDs).Error; errCat != nil {
|
if errCat := db.Preload("Translations").Find(&categories, catIDs).Error; errCat != nil {
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ type Brand struct {
|
||||||
Name string `gorm:"default:TESTBRAND"`
|
Name string `gorm:"default:TESTBRAND"`
|
||||||
Code string
|
Code string
|
||||||
Status bool
|
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
|
var brandObject Brand
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ type Product struct {
|
||||||
BrandID uint `sql:"DEFAULT:NULL"`
|
BrandID uint `sql:"DEFAULT:NULL"`
|
||||||
Brand Brand
|
Brand Brand
|
||||||
Images []ProductImage
|
Images []ProductImage
|
||||||
Categories [3]Category `gorm:"many2many:product_categories;"`
|
Categories []Category `gorm:"many2many:product_categories;"`
|
||||||
AttributeValues []ProductAttributeValue
|
AttributeValues []ProductAttributeValue
|
||||||
SuperAttributes []Attribute `gorm:"many2many:product_super_attributes;"`
|
SuperAttributes []Attribute `gorm:"many2many:product_super_attributes;"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue