Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Retreive list of order based on list of orderId via SOAP in C#? 
 
sanmic
Member
 
Total Posts:  54
Joined:  2009-12-26
 

Hi,

I’ve have this problem to get a list of orders based from a list of order ids.
Getting just one order based on an orderid is not a problem, but when I have a list it doesn’t work.

Here is my sample code:

public MagentoService.salesOrderListEntity[] getOrdersFromOrderIdList(List<stringorderIdList)
        
{
            string sessionId
;
            
sessionId helper.GetSessionId();

            
int i;
            
0;

            
MagentoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient mage = new MagentoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient();
            
MagentoService.salesOrderEntity salesOrderEntity = new MagentoService.salesOrderEntity();
            
MagentoService.salesOrderListEntity[] salesOrderList;

            
MagentoService.associativeEntity[] ae = new MagentoService.associativeEntity[orderIdList.Count()];
            
MagentoService.filters filter = new MagentoService.filters();
            
MagentoService.complexFilter[] orderFilters = new MagentoService.complexFilter[orderIdList.Count()];
            
            foreach (
string item in orderIdList)
            
{
                ae[i] 
= new MagentoService.associativeEntity();
                
orderFilters[i] = new MagentoService.complexFilter();
                
orderFilters[i].key "increment_id";
                
ae[i].key "eq";
                
ae[i].value item;
                
orderFilters[i].value ae[i];

                
i++;   
            
}

            filter
.complex_filter orderFilters;
            
salesOrderList mage.salesOrderList(sessionIdfilter);
            
            return 
salesOrderList;
        
}

In PHP it seems like you can put in a string array of orderids, but somehow this can’t be done via SOAP and C#.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Opahle
Jr. Member
 
Total Posts:  1
Joined:  2011-11-21
 

Hey There,

according to different sources and the poor documentation,
you should use “in” as the filter key instead of “eq” (equals).
then write your ids comma separeted in the value part of your AssociativeEntity.

You should retrieve an entity for every id in value.

Problem I have in C# is, that i only get an entity for the first id back.

Do not know why, yet. But i hope it helps you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sanmic
Member
 
Total Posts:  54
Joined:  2009-12-26
 

Thank you, but I cannot get it to work.

Here is the latest test code:

string sessionId;

            
MagentoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient mage = new MagentoService.Mage_Api_Model_Server_V2_HandlerPortTypeClient();
            
MagentoService.salesOrderEntity salesOrderEntity = new MagentoService.salesOrderEntity();
            
MagentoService.salesOrderListEntity[] salesOrderList;

            
MagentoService.associativeEntity ae;
            
MagentoService.filters filter = new MagentoService.filters();
            
MagentoService.complexFilter[] orderFilters = new MagentoService.complexFilter[1];
            
ae = new MagentoService.associativeEntity();

            
orderFilters[0] = new MagentoService.complexFilter();
            
orderFilters[0].key "increment_id";
            
ae.key "in";
            
ae.value "200001585,200001585,200001582";
            
orderFilters[0].value ae;
            
filter.complex_filter orderFilters;

            
sessionId helper.GetSessionId();

            
salesOrderList mage.salesOrderList(sessionIdfilter);

            return 
salesOrderList;
 
Magento Community Magento Community
Magento Community
Magento Community
 
Joduk77
Jr. Member
 
Total Posts:  4
Joined:  2012-12-06
 

I’m running into the same issue trying to filter salesOrderList

OrderListcFilter(1) = New MagentoService.complexFilter ‘ status
OrderListcFilter(1).key = “status”
OrderListcFilter(1).value = New associativeEntity With {.key = “in”, .value = “Pending, Exported"}

Were you able to confirm that the values are comma delimited in the associativeEntity value?

 
Magento Community Magento Community
Magento Community
Magento Community
 
sanmic
Member
 
Total Posts:  54
Joined:  2009-12-26
 

I had to give up this piece of code.

Tried every possible combination, but nothing worked.

So, sorry I can’t help you out here.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top