order filter

58 views
Skip to first unread message

Johannes Nel

unread,
Feb 24, 2011, 8:10:29 AM2/24/11
to magja-discuss
Hi All

Can someone provide a pointer to me how to use the orders filter with the list orders call.

Thanks
Johan

--
j:pn
\\no comment

e w

unread,
Feb 25, 2011, 4:26:02 AM2/25/11
to magja-discuss
Hi,

I *think* the filters don't work with this version of the API (through
java). I suspect that 's why there is a v2_soap API. However, I have
little knowledge about magento, and I certainly would like to know if
there is a possibility with the current Magja version to effectively
use the filters (I tried to use store_id and updated_at criteria, but
neither of them is really filtering the result)

Am I correct in this, do you have any hints to use the filters in the
current version?

Or do you have some hints to solve it? I would certainly like to
contribute a solution if I 'd only know what I should do (providing
that I'm capable to do it of course...)

Best,
Erwin

PS. I think you all did great work with the magja project

Christoph Petersen

unread,
Feb 25, 2011, 6:20:52 AM2/25/11
to magja-discuss
Hi Erwin,

On Feb 25, 10:26 am, e w <werk...@gmail.com> wrote:
> Hi,
>
> I *think* the filters don't work with this version of the API (through
> java). I suspect that 's why there is a v2_soap API. However, I have
> little knowledge about magento, and I certainly would like to know if
> there is a possibility with the current Magja version to effectively
> use the filters (I tried to use store_id and updated_at criteria, but
> neither of them is really filtering the result)
>

The functioning of the filters should not be impacted whether you use
V1 or V2. V2 is simply a more explicit WSDL description but basically
wraps the same calls to Magento. V1 uses one major SOAP call namely
"call" which then contains a resource path to what action needs to be
executed on server side.

> Am I correct in this, do you have any hints to use the filters in the
> current version?
>
> Or do you have some hints to solve it? I would certainly like to
> contribute a solution if I 'd only know what I should do (providing
> that I'm capable to do it of course...)

Unfortunately, I did not yet use filters so I can't give any more
information about them.

>
> Best,
> Erwin

BR
Christoph

>
> PS. I think you all did great work with the magja project

Nothing to add to that! :)

Johannes Nel

unread,
Feb 25, 2011, 6:35:30 AM2/25/11
to magja-...@googlegroups.com, e w
this is an important thing for me to figure out so I will be looking into it on monday.

what i am aiming for is to filter orders by status on the magento side of things. Basically when I export orders to send of for fulfullment, i will be updating the products status to some arb status (via the addComment method) and as such getting new orders that have not passed to fulfullment would be a "get Orders where status is pending"

e w

unread,
Mar 9, 2011, 5:25:17 AM3/9/11
to magja-discuss
Dear Christoph,

Thanks for pointing that out to me, so I didn't have to look at the
wrong places for a solution.


I got the filters working, although it is very prototypical and should
be made generic.

The base of the problem with the current implementation lies in that
the filter is serialized as a array of items, instead as a nested map.
Therefore the filter that you define (OrderFilter) loses all meaning
to the magento api once it gets serialized (no key-nested map binding
anymore).

So I took a look at a specific filtered order request and adapted the
serialization process for this situation. (php, use: $soap-
>__getLastRequest(); to inspect the sent soap request after the call)

My php example uses a filter with two parts: orders that were updated
after jan 2010, restrict to store nb 7

$filters = array('updated_at' => array('gt' => '2010-01-01 13:31:50'),
'store_id' => array('eq' => 7));


php default soap client serializes this to an args array element with
one nested item. Within the nested item, two item nodes are added with
"key" and "value" children. The key is the getProperty() (e.g.
'updated_at'). The value is a map again with key ('gt') and value
('2010-01-01 13:31:50') child nodes (getOperator() and getValue()
respectively).

Magja can of course output the same soap request, so I did a test with
two changes

I changed the OrderFilter.serializeToApi()
-> every getProperty() key has a separate Map with operator and value

I changed the SoapCallFactory,createCall(String sessionId, String
methodPath, Object arg)
->if arg is the nested map type that is created by
OrderFilter.serializeToApi()
->serialize 'the php-way'

The code I used is just for testing, and I only need to know *if* the
filters will work with Magja at this stage of my project. So I'll
leave it here for now. But if anyone wants to know what I did exactly
in this test, don't hesitate to contact me.





On Feb 25, 12:20 pm, Christoph Petersen

Johannes Nel

unread,
Mar 16, 2011, 4:13:22 AM3/16/11
to magja-...@googlegroups.com
I am still not getting this right

 OrderFilterItem item = new OrderFilterItem("status", "Like", "%pending%");

is what I am trying. Has anyone got an idea how I can filter orders by status?
Reply all
Reply to author
Forward
0 new messages