update cart
This commit is contained in:
@@ -38,6 +38,7 @@ const (
|
||||
|
||||
type CartItem struct {
|
||||
Id int `json:"id"`
|
||||
ItemId int `json:"itemId,omitempty"`
|
||||
ParentId int `json:"parentId,omitempty"`
|
||||
Sku string `json:"sku"`
|
||||
Name string `json:"name"`
|
||||
@@ -46,6 +47,12 @@ type CartItem struct {
|
||||
Stock StockStatus `json:"stock"`
|
||||
Quantity int `json:"qty"`
|
||||
Tax int `json:"tax"`
|
||||
Brand string `json:"brand,omitempty"`
|
||||
Category string `json:"category,omitempty"`
|
||||
Category2 string `json:"category2,omitempty"`
|
||||
Category3 string `json:"category3,omitempty"`
|
||||
Category4 string `json:"category4,omitempty"`
|
||||
Category5 string `json:"category5,omitempty"`
|
||||
Disclaimer string `json:"disclaimer,omitempty"`
|
||||
ArticleType string `json:"type,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
@@ -139,7 +146,15 @@ func getItemData(sku string, qty int) (*messages.AddItem, error) {
|
||||
outlet = &outletGrade
|
||||
}
|
||||
|
||||
brand, _ := item.Fields[2].(string)
|
||||
category, _ := item.Fields[10].(string)
|
||||
category2, _ := item.Fields[11].(string)
|
||||
category3, _ := item.Fields[12].(string)
|
||||
category4, _ := item.Fields[13].(string)
|
||||
category5, _ := item.Fields[14].(string)
|
||||
|
||||
return &messages.AddItem{
|
||||
ItemId: int64(item.Id),
|
||||
Quantity: int32(qty),
|
||||
Price: int64(price),
|
||||
OrgPrice: int64(orgPrice),
|
||||
@@ -147,6 +162,12 @@ func getItemData(sku string, qty int) (*messages.AddItem, error) {
|
||||
Name: item.Title,
|
||||
Image: item.Img,
|
||||
Stock: int32(stock),
|
||||
Brand: brand,
|
||||
Category: category,
|
||||
Category2: category2,
|
||||
Category3: category3,
|
||||
Category4: category4,
|
||||
Category5: category5,
|
||||
Tax: 2500,
|
||||
ArticleType: articleType,
|
||||
Disclaimer: item.Disclaimer,
|
||||
@@ -290,6 +311,7 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
|
||||
}
|
||||
c.Items = append(c.Items, &CartItem{
|
||||
Id: c.lastItemId,
|
||||
ItemId: int(msg.ItemId),
|
||||
Quantity: int(msg.Quantity),
|
||||
Sku: msg.Sku,
|
||||
Name: msg.Name,
|
||||
@@ -297,6 +319,12 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
|
||||
Image: msg.Image,
|
||||
Stock: StockStatus(msg.Stock),
|
||||
Disclaimer: msg.Disclaimer,
|
||||
Brand: msg.Brand,
|
||||
Category: msg.Category,
|
||||
Category2: msg.Category2,
|
||||
Category3: msg.Category3,
|
||||
Category4: msg.Category4,
|
||||
Category5: msg.Category5,
|
||||
OrgPrice: msg.OrgPrice,
|
||||
ArticleType: msg.ArticleType,
|
||||
Outlet: msg.Outlet,
|
||||
|
||||
Reference in New Issue
Block a user