KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: PiotrN on March 01, 2012, 10:37:25 am

Title: AdminOrders are not populated
Post by: PiotrN on March 01, 2012, 10:37:25 am
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.
Title: Re: AdminOrders are not populated
Post by: PiotrN on March 01, 2012, 11:36:58 am
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...?
Title: Re: AdminOrders are not populated
Post by: julie on March 01, 2012, 02:12:29 pm
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.
Title: Re: AdminOrders are not populated
Post by: PiotrN on March 02, 2012, 07:46:25 am
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 (http://www.konakart.com/javadoc/admin/com/konakartadmin/appif/KKAdminIf.html#getOrdersCreatedSince%28java.lang.String,%20java.util.Calendar,%20int%29) () but not in the implementation (http://www.konakart.com/javadoc/admin/com/konakartadmin/bl/KKAdmin.html#getOrdersCreatedSince%28java.lang.String,%20java.util.Calendar,%20int%29). I guess this could block e.g. Eclipse from showing a warning when using this deprecated method?