• Welcome to KonaKart Community Forum. Please login or sign up.
 

AdminOrders are not populated

Started by PiotrN, March 01, 2012, 10:37:25 am

Previous topic - Next topic

PiotrN

Howdy,

I've got some problem when fetching Orders from KKWSAdmin:

KKWSAdmin konaKartAdmin = new KKWSAdmin();
AdminOrder[] ordersCreatedSince = konaKartAdmin.getOrdersCreatedSince(sessionId, since, AdminLanguageMgr.DEFAULT_LANG);


I can iterate over AdminOrders but:

adminOrder.getOrderProducts() returns null
adminOrder.getNumProducts() returns 0

Those values are returned for all orders despite the fact that from KonaKart Admin web console I can see some products for each order.

Any ideas what's going on?

Thanks in advance.

PiotrN

As a side note, if I use the ID from above code and fetch the order using:

AdminOrder orderForOrderId = konaKartAdmin.getOrderForOrderId(sessionId, adminOrder.getId());

The order is properly populated.

But... why...?

julie

That API call has been deprecated for a long time. Look at the Javadoc :

Deprecated. From version 2.2.4.0 you should use getOrders().

The reason for the orders not being fully populated is performance. In many cases when you retrieve a list of orders you do so in order to choose the one that you really want. In this case you don't require the full details of each order. When you need the full details you can then use the getOrderForOrderId() method as you pointed out.

PiotrN

Thanks a lot Julie!

Yeah, I supposed that it was because of performance reasons but I've searched for some "populateOrders(-)" method and failed to find it :-)

By the way, the method seems to be annotated as deprecated in the interface () but not in the implementation. I guess this could block e.g. Eclipse from showing a warning when using this deprecated method?