From ac5b104eab25c08c8c0e3cf645d00254c0ef41f1 Mon Sep 17 00:00:00 2001 From: Dom Date: Sat, 8 Dec 2018 19:30:35 +0100 Subject: [PATCH] add value ProductLink --- webActions.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/webActions.go b/webActions.go index e6e398d..2071b94 100644 --- a/webActions.go +++ b/webActions.go @@ -24,6 +24,7 @@ type paxanWebOrderEntry struct { Position string ArticleNumber int Description string + ProductLink string Amount string Price string Total string @@ -170,8 +171,13 @@ func paxanGetOrderDetails(client *http.Client, orderNumber int) ([]paxanWebOrder var row []string s.Find(".tableCell").Each(func(j int, s *goquery.Selection) { text := s.Contents().Text() + // Column 3 contains some more info if j == 2 { text = s.Find(".lineItemName").Text() + // Search for the link to the product page + linkTag := s.Find("a") + link, _ := linkTag.Attr("href") + row = append(row, link) } text = strings.Replace(text, "\n", "", -1) @@ -183,13 +189,14 @@ func paxanGetOrderDetails(client *http.Client, orderNumber int) ([]paxanWebOrder num, _ := strconv.Atoi(row[1]) n := paxanWebOrderEntry{Position: row[0], ArticleNumber: num, - Description: row[2], - Amount: row[3], - Price: row[4], - Total: row[5], - Amount2: row[6], - Price2: row[7], - Total2: row[8]} + Description: row[3], + ProductLink: row[2], + Amount: row[4], + Price: row[5], + Total: row[6], + Amount2: row[7], + Price2: row[8], + Total2: row[9]} list = append(list, n) }) @@ -228,6 +235,7 @@ func ExportNewOrders(client *http.Client, lastOrder int) error { orderDetail.Position + ";" + strconv.Itoa(orderDetail.ArticleNumber) + ";" + orderDetail.Description + ";" + + orderDetail.ProductLink + ";" + orderDetail.Amount + ";" + orderDetail.Price + ";" + orderDetail.Total + ";" +