API Questions on Kentico API.
Version 5.x > API > get orderitem by orderid View modes: 
User avatar
Member
Member
wtzeng-micro-datanet - 8/8/2011 12:14:19 PM
   
get orderitem by orderid
Hi maybe I wasn't reading enough, but how do you get orderitem by the the orderid??
getorderiteminfo() is using orderitemid
do I have to build a query for getorderitems()?
thanks

User avatar
Guest
joe@jmawebtechnologies.com - 8/8/2011 1:55:31 PM
   
RE:get orderitem by orderid
Hi,

Try this:

DataSet dsQ = OrderItemInfoProvider.GetOrderItems(String.Format("OrderItemOrderID = '{0}'", order.OrderID), "OrderItemOrderID ASC", 1000, "OrderItemOrderID, OrderItemID, OrderItemSKUID, OrderItemUnitCount, OrderItemUnitPrice");

DataRowCollection drC = dsQ.Tables[0].Rows;

//Loop through each product
foreach (DataRow d in drC)
{
SKUInfo sk = SKUInfoProvider.GetSKUInfo(int.Parse(d["OrderItemSKUID"].ToString()));
//Custom Code
}

User avatar
Member
Member
wtzeng-micro-datanet - 8/8/2011 2:24:08 PM
   
RE:get orderitem by orderid
Thank you.
Its interesting they didn't prove API to get order item base on the order id, instead we have to do a SQL query