ajayz15 / magja

Automatically exported from code.google.com/p/magja
1 stars 0 forks source link

order filter method does not work as expected #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In the unit-test method 
com.google.code.magja.service.order.OrderRemoteServiceTest.testList()
any given filter will return all orders. (just like the TODO comment says)

So I modified the serializeToApi method of the OrderFilter class in that way, 
that the magento API will accept that filter.
Put the Map with the operator and value into another Map with the property as 
key and the operator/value-Map as value. Now you can filter through your orders.

Maybe you want to merge it into your codebase...

Thank you for this yery beautiful project!

Kind regards,

Tomislav Dedus

Original issue reported on code.google.com by Tomi.De...@googlemail.com on 25 Feb 2011 at 9:03

Attachments:

GoogleCodeExporter commented 9 years ago
Hi guys,

I get a error when i attempt use OrderFilter in order listing service. I need 
return only 5 latests orders but i get a error message: Can't decode apache 
map, missing key. 
The code is:

OrderRemoteService oservice = RemoteServiceFactory.getOrderRemoteService();
      ArrayList<OrderFilterItem> ofitens = (new ArrayList<OrderFilterItem>(0));

      OrderFilterItem ofitem = new OrderFilterItem("", "", "");
      ofitem.setOperator("from");
      ofitem.setProperty("created_at");
      ofitem.setValue( "2012-03-01 00:00:00");
      OrderFilter of = new OrderFilter();
      ofitens.add(ofitem);
      of.setItems(ofitens);

      try {

    //   Order order = RemoteServiceFactory.getOrderRemoteService().getById("10002334");
        List<Order> ordens = oservice.list(null);

        for (Order order : ordens) {
            System.out.println(order.getId());

        }
    } catch (ServiceException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

I change the OrderFilter serialize as in attach but without sucess. Can help-me?

Original comment by deniscas...@gmail.com on 2 Apr 2012 at 10:44

GoogleCodeExporter commented 9 years ago
Hi,

i think your specified Operator may not work as expected. Here is some of our 
working code:

OrderFilter filter = new OrderFilter();
filter.getItems().add(new OrderFilterItem("updated_at", "gt", "2012-01-01"));

In this case the Operator is "gt". In your case it should be "eq"...

Greetings

Tomislav Dedus

Original comment by Tomi.De...@googlemail.com on 20 Jul 2012 at 7:57