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

Getting option id and option value id in AdminOption object

Started by ckool, April 02, 2008, 12:15:20 pm

Previous topic - Next topic

ckool

I'm trying to get the option id and the the option value id from a Product Order but always get the value 0 (zero) for both attributes using the methods getId() and getValueId() in the object AdminOption.

I've got an Array of AdminOption objects using the the method getOpts() from an object AdminOrderProduct and my Konakart version  2.2.0.0.

Am I doing something wrong? How can I get the correct values for those attributes?

Thank you in advance.

kate

Hi,

How did you get your AdminOrderProduct object in the first place?

Can you post a snippet of code?

Regards,
Kate

ckool

Hi Kate,

Here is a snippet of code:

KKAdmin eng = new KKAdmin();
sessionId = eng.login(DEFAULT_USERNAME, DEFAULT_PASSWORD);

AdminOrder[] orders = eng.getOrdersCreatedSince(sessionId, yesterday, com.konakartadmin.bl.AdminLanguageMgr.DEFAULT_LANG);
for(int i=0;i<orders.length;i++)
{
  AdminOrder tmpOrder = orders;
  int orderId = tmpOrder.getId();
         
  AdminOrder order = eng.getOrderForOrderId(sessionId, orderId);

  AdminOrderProduct[] products = order.getOrderProducts();
  for(int j=0;j<numProducts;j++)
  {
    AdminOrderProduct orderProduct = products[j];
    AdminOption[] options = orderProduct.getOpts();
    for(int k=0;k<options.length;k++)
    {
      int optionId = option.getId();
      int valueId = option.getValueId();
    }
  }

}

Thank you for your help.

ckool

I'm sorry, i forgot a line of code in the previous snippet, here is the correct snippet:

KKAdmin eng = new KKAdmin();
sessionId = eng.login(DEFAULT_USERNAME, DEFAULT_PASSWORD);

AdminOrder[] orders = eng.getOrdersCreatedSince(sessionId, yesterday, com.konakartadmin.bl.AdminLanguageMgr.DEFAULT_LANG);
for(int i=0;i<orders.length;i++)
{
  AdminOrder tmpOrder = orders;
  int orderId = tmpOrder.getId();
         
  AdminOrder order = eng.getOrderForOrderId(sessionId, orderId);

  AdminOrderProduct[] products = order.getOrderProducts();
  for(int j=0;j<numProducts;j++)
  {
    AdminOrderProduct orderProduct = products[j];
    AdminOption[] options = orderProduct.getOpts();
    for(int k=0;k<options.length;k++)
    {
      AdminOption option = options[k];
      int optionId = option.getId();
      int valueId = option.getValueId();
    }
  }

}

Thank you very much

kate

Hi ckool,

The IDs aren't populated there but the values are:

Try using..

option.getName()
option.getValue()


.. in your final inner loop.

Regards,
Kate