2

I am using Magja, java soap api for magento. I want to filter orders by order id or any other property, also want to sort orders by ASC or DESC. But my current code is not working for that, I need help to sort this out, thanks in advance for any help. My current code for filter is below

TestOrder to = new TestOrder();
OrderFilter filter = new OrderFilter();
filter.getItems().add(new OrderFilterItem("state", "=", "new"));
filter.getItems().add(new OrderFilterItem("store_id", "=", "3"));
filter.getItems().add(new OrderFilterItem("order_id", "gt","300000065"));       
List<Order> list = to.service.list(filter);

Note: filters by state and store_id are working fine. But order_id/increment_id filters(gt, lt, eq etc) are not working at all.

1

First of all calling this is wrong.

filter.getItems().add(new OrderFilterItem("order_id", "gt","300000065")); 

order_id does not exist. it is entity_id. And the value 300000065 looks like an increment_id value, not a table PK id.

This should work (I have no idea if you should use gt or > try them both).

filter.getItems().add(new OrderFilterItem("order_id", "gt","12"));  

As for filtering by the increment_id maybe you should take into account that the field is not numerical. it is varchar(50). Maybe this affects your filtering.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.