cinsiyet eklenior

This commit is contained in:
merdan 2022-12-17 12:07:49 +05:00
parent 0050de6fad
commit 66ebb8ed41
3 changed files with 22 additions and 11 deletions

View File

@ -1,17 +1,12 @@
couch_db_source=http://admin:adminadmin@192.168.1.2:5984/ couch_db_source=
db_trendyol=trendyol_db_v2 db_trendyol=trendyol_db_v2
db_ty_categories=ty_categories db_ty_categories=ty_categories
remote_url=https://sarga.com.tm/api/ remote_url=
descendant_category_url=descendant-categories descendant_category_url=descendant-categories
db=test_baza database_url=
du=merdan couchdb_url=
dp=qazwsx12 scout_flash=
da=localhost port=
dp=3306
#database_url ="merdan:qazwsx12@tcp(127.0.0.1:3306)/test_baza?parseTime=true"
database_url ="orient:orient@tcp(192.168.1.2:3306)/bagisto_sarga?parseTime=true"
couchdb_url = "http://admin:adminadmin@192.168.1.2:5984/"
scout_flash = "http://sarga.com.tm/scrap/scoute-flush"

View File

@ -65,6 +65,8 @@ type ProductFlat struct {
MetaKeywords string `sql:"DEFAULT:NULL" gorm:"default:null"` MetaKeywords string `sql:"DEFAULT:NULL" gorm:"default:null"`
BrandID uint `sql:"DEFAULT:NULL" gorm:"default:null"` BrandID uint `sql:"DEFAULT:NULL" gorm:"default:null"`
Brand Brand Brand Brand
Cinsiyet int `sql:"DEFAULT:NULL" gorm:"default:null"`
CinsiyetLabel string `sql:"DEFAULT:NULL" gorm:"default:null"`
} }
type ProductImage struct { type ProductImage struct {

View File

@ -162,6 +162,11 @@ func (pr *ProductRepo) makeProductFlat(productId uint) gm.ProductFlat {
flat.BrandID = pr.Brand.ID flat.BrandID = pr.Brand.ID
} }
if pr.Data.Cinsiyet != "" {
flat.Cinsiyet = int(pr.SexOption.ID)
flat.CinsiyetLabel = pr.Data.Cinsiyet
}
if !pr.HasSizeVariants() { if !pr.HasSizeVariants() {
flat.MinPrice = pr.Data.Price.DiscountedPrice.Value flat.MinPrice = pr.Data.Price.DiscountedPrice.Value
flat.MaxPrice = math.Max(pr.Data.Price.OriginalPrice.Value, pr.Data.Price.DiscountedPrice.Value) flat.MaxPrice = math.Max(pr.Data.Price.OriginalPrice.Value, pr.Data.Price.DiscountedPrice.Value)
@ -229,6 +234,15 @@ func (pr *ProductRepo) makeVariantFlat(variant models.Variant, SizID, parentID,
flat.ColorLabel = pr.Data.Color flat.ColorLabel = pr.Data.Color
} }
if pr.Data.Brand != "" {
flat.BrandID = pr.Brand.ID
}
if pr.Data.Cinsiyet != "" {
flat.Cinsiyet = int(pr.SexOption.ID)
flat.CinsiyetLabel = pr.Data.Cinsiyet
}
return flat return flat
} }