|
|
@@ -16,8 +16,6 @@ import (
|
|
|
|
|
|
func CreateXMLFeed() {
|
|
|
|
|
|
- const CrossDockingCategoryId = "999"
|
|
|
-
|
|
|
type Category struct {
|
|
|
Text string `xml:",chardata"`
|
|
|
Id string `xml:"id,attr"`
|
|
|
@@ -32,7 +30,7 @@ func CreateXMLFeed() {
|
|
|
|
|
|
type Offer struct {
|
|
|
Id string `xml:"id,attr"`
|
|
|
- Avalieble string `xml:"available,attr"`
|
|
|
+ Available string `xml:"available,attr"`
|
|
|
Name string `xml:"name"`
|
|
|
URL string `xml:"url"`
|
|
|
CategoryId string `xml:"categoryId"`
|
|
|
@@ -85,7 +83,6 @@ func CreateXMLFeed() {
|
|
|
shop.Category = append(shop.Category, category)
|
|
|
}
|
|
|
|
|
|
- // +++ Предопределенная категория для кросс-докинга
|
|
|
var categoryCrossDocking = Category{
|
|
|
Text: "Кросс-Докинг",
|
|
|
ParentId: "1",
|
|
|
@@ -93,12 +90,11 @@ func CreateXMLFeed() {
|
|
|
URL: "999",
|
|
|
}
|
|
|
shop.Category = append(shop.Category, categoryCrossDocking)
|
|
|
- // --- Предопределенная категория для кросс-докинга
|
|
|
|
|
|
for _, value := range rows {
|
|
|
var offer = Offer{
|
|
|
Id: value.CodeCarCaDe,
|
|
|
- Avalieble: "true",
|
|
|
+ Available: "true",
|
|
|
Name: value.Name,
|
|
|
URL: "https://b2bn.kngnn.ru/?item-code=" + value.CodeUT10,
|
|
|
CategoryId: value.CategoryId,
|
|
|
@@ -170,6 +166,30 @@ func CreateXMLFeed() {
|
|
|
Text: value.NumberSuffix,
|
|
|
Name: "number_suffix",
|
|
|
})
|
|
|
+ offer.Param = append(offer.Param, Param{
|
|
|
+ Text: strconv.FormatBool(value.Deficit),
|
|
|
+ Name: "deficit",
|
|
|
+ })
|
|
|
+ offer.Param = append(offer.Param, Param{
|
|
|
+ Text: strconv.FormatFloat(value.Width, 'f', 6, 64),
|
|
|
+ Name: "width",
|
|
|
+ })
|
|
|
+ offer.Param = append(offer.Param, Param{
|
|
|
+ Text: strconv.FormatFloat(value.Height, 'f', 6, 64),
|
|
|
+ Name: "height",
|
|
|
+ })
|
|
|
+ offer.Param = append(offer.Param, Param{
|
|
|
+ Text: strconv.FormatFloat(value.Weight, 'f', 6, 64),
|
|
|
+ Name: "weight",
|
|
|
+ })
|
|
|
+ offer.Param = append(offer.Param, Param{
|
|
|
+ Text: strconv.FormatFloat(value.Length, 'f', 6, 64),
|
|
|
+ Name: "length",
|
|
|
+ })
|
|
|
+ offer.Param = append(offer.Param, Param{
|
|
|
+ Text: strconv.FormatFloat(value.Multiple, 'f', 6, 64),
|
|
|
+ Name: "multiple",
|
|
|
+ })
|
|
|
|
|
|
if value.IdNumbers != nil {
|
|
|
numbers := strings.Split(*value.IdNumbers, ";")
|
|
|
@@ -181,6 +201,16 @@ func CreateXMLFeed() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if value.Certificates != nil {
|
|
|
+ certificates := strings.Split(*value.IdNumbers, ";")
|
|
|
+ for idx, cert := range certificates {
|
|
|
+ offer.Param = append(offer.Param, Param{
|
|
|
+ Text: cert,
|
|
|
+ Name: "certificate" + strconv.Itoa(idx+1),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
shop.Offer = append(shop.Offer, offer)
|
|
|
|
|
|
}
|