PDA

View Full Version : Help with getProductList


authcode
01-04-07, 19:22
I'm writing code from scratch and I can't seem to get a product list for a category with the following code:

$oClient = new api_client();
$aProductListParams = array('iCategoryId'=>$currentCategory);
$oProductList = $oClient->call('getProductList', $aProductListParams);
echo $oProductList->iTotalCount.'<br />';

where $currentCategory is any valid categoryId. iTotalCount is always 0. I'm assuming that if I don't pass in merchantIds then it defaults to products from all merchants? If not, how do I get a list of merchantIds for a category??? Would really appreciate any help!

authcode
02-04-07, 12:05
I'm sure AW staff are busy with the launch but if anyone can figure this one out I'd really appreciate it. I'm stuck with my site until I can get past this one - I just can't see what I'm doing wrong. Cheers.

amarath
02-04-07, 14:14
Hi Auth,

Sorry for the delay in looking into this.

Will query this with our developers now and return to you.

Thanks for your patience.

Amo

digitalwindow
02-04-07, 17:46
Hi authcode.

There are some required params missing with your code there. Do you have errors turned off?

If I take your code and run it I receive: SOAP-ERROR: Encoding: object hasn't 'iLimit' property

Try these Params:
$aProductListParams = array('iCategoryId'=>$currentCategory, 'iLimit'=>20, 'iOffset'=>0, 'bIncludeDescendants'=>true);Let me know if you still have no results.

Regards

authcode
02-04-07, 18:04
Your parameter list does get me results - thanks. But I'm a bit confused.
I assumed that if I didn't pass a parameter it would use the default as defined in the class - in this case set by the sanity checks in class.api_product_list.php? I can't see why it's not using those defaults?
I'll turn on the soap debug and error messages from now on though so I can catch stuff like this (only just found those). Thanks again!

digitalwindow
02-04-07, 18:32
Hi authcode.

You are instantiating api_client, not api_productList.

authcode
02-04-07, 18:34
Of course! Thank you - that one was killing me :)