-2
對於Kentico我完全陌生,我創建了電子商務網站,並希望使用API來創建訂單。任何人都可以告訴我我應該使用哪種方法??也想詢問是否有人試圖在Sharepoint應用程序上顯示kentico網站。如何在我的網站上創建Kentico的新訂單?
對於Kentico我完全陌生,我創建了電子商務網站,並希望使用API來創建訂單。任何人都可以告訴我我應該使用哪種方法??也想詢問是否有人試圖在Sharepoint應用程序上顯示kentico網站。如何在我的網站上創建Kentico的新訂單?
創建訂單是有點複雜,因爲你需要得到客戶,貨幣,送貨地址,產品和其他可能與對象。一個簡單的例子可以是這樣的:
// Gets the first customer whose last name is 'Smith'
CustomerInfo customer = CustomerInfoProvider.GetCustomers()
.WhereEquals("CustomerLastName", "Smith")
.FirstObject;
// Prepares the order addresses
OrderAddressInfo orderBillingAddress = null;
OrderAddressInfo orderShippingAddress = null;
// Gets the customer's address
AddressInfo customerAddress = AddressInfoProvider.GetAddresses()
.WhereEquals("AddressCustomerID", customer.CustomerID)
.FirstObject;
if (customerAddress != null)
{
// Gets the data from the customer's address
orderBillingAddress = OrderAddressInfoProvider.CreateOrderAddressInfo(customerAddress);
orderShippingAddress = OrderAddressInfoProvider.CreateOrderAddressInfo(customerAddress);
// Sets the order addresses
OrderAddressInfoProvider.SetAddressInfo(orderBillingAddress);
OrderAddressInfoProvider.SetAddressInfo(orderShippingAddress);
}
// Gets a status for the order
OrderStatusInfo orderStatus = OrderStatusInfoProvider.GetOrderStatusInfo("NewStatus", SiteContext.CurrentSiteName);
// Gets a currency for the order
CurrencyInfo currency = CurrencyInfoProvider.GetCurrencyInfo("NewCurrency", SiteContext.CurrentSiteName);
if ((customer != null) && (orderStatus != null) && (currency != null) && (orderBillingAddress != null))
{
// Creates a new order object and sets its properties
OrderInfo newOrder = new OrderInfo
{
OrderInvoiceNumber = "1",
OrderBillingAddress = orderBillingAddress,
OrderShippingAddress = orderShippingAddress,
OrderTotalPrice = 200,
OrderTotalTax = 30,
OrderDate = DateTime.Now,
OrderStatusID = orderStatus.StatusID,
OrderCustomerID = customer.CustomerID,
OrderSiteID = SiteContext.CurrentSiteID,
OrderCurrencyID = currency.CurrencyID
};
// Saves the order to the database
OrderInfoProvider.SetOrderInfo(newOrder);
}
這是從Kentico docs我真的建議檢查出因爲有許多你可能會發現有用的更多的例子服用。
關於你的第二個問題 - 我不太清楚你所說的在SharePoint應用程序中顯示Kentico意思。 Kentico是一個獨立的ASP Web表單應用程序需要在IIS上運行,並且不能由自己是在SharePoint嵌入式。
非常方便,很多日Thnx另一個 – Dii
PLZ問題..我不能在文檔找到。如何從數據庫獲取產品數據,所以我用我自己選擇使用很多內部聯接..所以我只想問是他們獲取產品數據的另一種方法,它的附件和選項?感謝您的支持。 – Dii
嗨,我已經加入回答你的第二個問題,以便隨時檢查出來[這裏](http://stackoverflow.com/questions/36826799/creating-more-than-one-site-in-kentico/36833719# 36833719) – Enn