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

AdminCustomer getAddresses() method always return null

Started by giacomokk, July 27, 2017, 11:28:35 am

Previous topic - Next topic

giacomokk

Hi, i'm trying to get all defined addresses for a customer using the AdminCustomer class method "getAddresses". but it always return "null". I'm sure that the customer has more than one addresses stored in the db table address_book.

Can you help me?

Regards,

G


julie

You should use the AdminApi call
public AdminAddressSearchResult getAddresses(String sessionId, AdminAddressSearch search,
            int offset, int size) throws KKAdminException;

giacomokk

Hi, yes i've tried in this way:

AdminAddressSearch aas = new AdminAddressSearch();
                     
aas.setCustomerId(customer.getId());
                                          
AdminAddressSearchResult aasResult = adminEng.getAddresses(sessionId, aas, 0, 100);
                     
AdminAddress[] addresses = aasResult.getAddresses();

but the result is the same: empty array.

How can i solve the problem?

giacomokk

The solution is to set this fields as null:

aas.setZoneId(-1);
                  
aas.setProductId(-1);
                  
aas.setManufacturerId(-1);
                  
aas.setCountryId(-1);
                  
aas.setId(-1);

Now i can get the addresses.
I think that is better if someone add this part to konakart documentation  ;)

G