0
我目前正在開發一個使用Microsoft bot的.NET的ChatBot我創建了可用產品列表並使用Herocard在Carousel中顯示列表,並在客戶端點擊它時放置一個按鈕購買它帶他到該產品所在的問題網頁是我如何使用它的id,這樣我就可以把它放在按鈕BUY通過以下鏈接使用API獲取產品網址在prestashop中使用API
List<product> c = ListProduct.GetProductList();
List<Bukimedia.PrestaSharp.Entities.AuxEntities.language> lan = new List<Bukimedia.PrestaSharp.Entities.AuxEntities.language>();
foreach (product p in c)
{
lan = p.name;
foreach (Bukimedia.PrestaSharp.Entities.AuxEntities.language l in lan)
{
;
List<CardImage> cardImages = new List<CardImage>();
cardImages.Add(new CardImage(url: $"http://test.com/123456.jpg"));
List <CardAction> cardButtons = new List<CardAction>();
CardAction plButton = new CardAction()
{
Value =$"i don't know what i should put here",
Type = "openUrl",
Title = "Buy"
};
cardButtons.Add(plButton);
HeroCard plCard = new HeroCard()
{
Title = l.Value,
Subtitle = (p.price.ToString("C", Cultures.usa)),
Images = cardImages,
Buttons = cardButtons
};
Attachment plAttachment = plCard.ToAttachment();
replyMessage.Attachments.Add(plAttachment);
}
}
}