From 9fcd76a3db88c12e0952402b1cb181f343362ab0 Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 15 Sep 2022 17:32:15 +0500 Subject: [PATCH] marketplace product id --- controllers/ImportController.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/controllers/ImportController.go b/controllers/ImportController.go index bef025b..1cdf927 100644 --- a/controllers/ImportController.go +++ b/controllers/ImportController.go @@ -589,13 +589,19 @@ func ImportProduct(product models.Product, db *gorm.DB) error { } func createSellerProduct(flat *gm.ProductFlat, sellerURL string) gm.MarketplaceProduct { + sellerID := sellers[sellerURL].ID + + if sellerID == 0 { + sellerID = 1 + } + sellerProduct := gm.MarketplaceProduct{ - MarketplaceSeller: sellers[sellerURL], - IsApproved: true, - Condition: "new", - Description: "scraped", - IsOwner: true, - ProductID: flat.ProductID, + MarketplaceSellerID: sellerID, + IsApproved: true, + Condition: "new", + Description: "scraped", + IsOwner: true, + ProductID: flat.ProductID, } for _, variant := range flat.Variants {