add value ProductLink

This commit is contained in:
Dom 2018-12-08 19:30:35 +01:00
parent b3464278ac
commit ac5b104eab
1 changed files with 15 additions and 7 deletions

View File

@ -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 + ";" +