marketplace product id

This commit is contained in:
merdan 2022-09-15 17:32:15 +05:00
parent 41a3552a97
commit 9fcd76a3db
1 changed files with 12 additions and 6 deletions

View File

@ -589,13 +589,19 @@ func ImportProduct(product models.Product, db *gorm.DB) error {
} }
func createSellerProduct(flat *gm.ProductFlat, sellerURL string) gm.MarketplaceProduct { func createSellerProduct(flat *gm.ProductFlat, sellerURL string) gm.MarketplaceProduct {
sellerID := sellers[sellerURL].ID
if sellerID == 0 {
sellerID = 1
}
sellerProduct := gm.MarketplaceProduct{ sellerProduct := gm.MarketplaceProduct{
MarketplaceSeller: sellers[sellerURL], MarketplaceSellerID: sellerID,
IsApproved: true, IsApproved: true,
Condition: "new", Condition: "new",
Description: "scraped", Description: "scraped",
IsOwner: true, IsOwner: true,
ProductID: flat.ProductID, ProductID: flat.ProductID,
} }
for _, variant := range flat.Variants { for _, variant := range flat.Variants {