Multiple complexFilter in Magento's api v2

Posted by Alekc on Stack Overflow See other posts from Stack Overflow or by Alekc
Published on 2009-12-17T10:51:38Z Indexed on 2010/06/10 1:52 UTC
Read the original article Hit count: 549

Filed under:
|
|

Currently I’m having some difficulties with using new Magento's soap v2 from c# interface.

With php i was able to do something like this:

$params["created_at"]["from"] = date("Y-m-d H:i:s",Functions::convert_time($dataDa));
$params["created_at"]["to"] = date("Y-m-d H:i:s",Functions::convert_time($dataA));
MageInterface::getSingleton()->shipmentList($params);

In this mode i was able to find list of orders which were created from $dataDa to $dataA without problems. With c# however it seems that only the last one of the selectors work.

My code:

var cpf = new complexFilter[2];
cpf[0] = new complexFilter
                    {
                        key = "created_at",
                        value = new associativeEntity
                        {
                            key = "to",
                            value = uxDataA.DateTime.ToString("yy-MM-dd HH:mm:ss")
                        }
                    });
cpf[1] = new complexFilter
                    {
                        key = "created_at",
                        value = new associativeEntity
                        {
                            key = "from",
                            value = uxDataDa.DateTime.ToString("yy-MM-dd HH:mm:ss")
                        }
                    });
var filters = new filters();
filters.complex_filter = cpf;
var risultato = mage.salesOrderList(sessionKey, filters);

In this mode only created_at->from criteria is taken in consideration (it's like second complex filter override previous one with the same key). Ideas?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about c#

Related posts about webservice