2012-06-29 66 views
1

我遇到問題檢索訂單的項目list.I可以拉取訂單號碼,但不是訂購的產品。我在C#visual Studio中運行Magento API。 我的代碼lookes這樣的:C#中的Magento API檢索所有訂單項目

class Program 
{ 
    //Mage_Api_Model_Server_V2_HandlerPortType handler = new Mage_Api_Model_Server_V2_HandlerPortType(); 
    static void Main(string[] args) 
    { 
     Mage_Api_Model_Server_V2_HandlerPortTypeClient handler = new Mage_Api_Model_Server_V2_HandlerPortTypeClient(); 
     try 
     { 
      //initiate connection 
      string session = handler.login("tauren_SOAP", "test123"); 
      filters mf = new filters(); 

      /* expiriment to grab order items */ 
      string order_id = ""; 
      salesOrderListEntity[] soe = handler.salesOrderList(session, mf); 
      foreach (salesOrderListEntity msoe in soe) 
      { 
       try 
       { 
        order_id = msoe.increment_id; 
        Console.WriteLine("Order Id: " + order_id); 
        orderItemIdQty itm = new orderItemIdQty(); 
        Console.WriteLine(itm.qty); 

        Console.WriteLine("-----------------------"); 
       } 
       catch (Exception exp) 
       { 
        Console.WriteLine(exp.ToString()); 
       } 
      } 
     } 
     catch (Exception ex) 
     { 
      Console.WriteLine(ex.ToString()); 
     } 

     //prompt for exit 
     Console.WriteLine("Finshed. Press Return to Exit..."); 
     Console.ReadLine(); 
    } 

如果你需要的信息了,請讓我知道。 先進的謝謝!

回答

2

您需要遍歷order.items ...

的foreach(salesOrderItemEntity的OrderDetail在msoe.items){ ... }

相關問題