PDA

View Full Version : how to display all the products...?


swathi.somaraj
03-09-09, 07:56
Hi all..
I want to get total products list from ps_client.php using Shopwindow API v3.
I passed parameters like this:


$aParams7 = array( 'iCategoryId' => 97, "sColumnToReturn" => $productcolumns, "bIncludeTree" => true);
$productcolumns = array(sName,sDescription);
$aParams17 = array('iLimit'=($oResponse->iTotalCount), 'iCategoryId' => 97, "sColumnToReturn" => $productcolumns, "bIncludeTree" => true);
$oResponse= $oClient->call('getProductList', $aParams7);
$oResponse1= $oClient->call('getProductList', $aParams17);
echo $oResponse1;



But im getting only 10 products and iTotalcout.
can u suggest me...?

currentstyle
17-09-09, 12:11
It's not possible to get back more than 100 products in one call, but, as an example, your code is not in the correct order, I've reordered it so that in theory it would work, but, it will result in an error due to the 100 items limit.

SoapError Object ( [sCode] => ns1:Client.LIMIT [sString] => Number of products requested exceeds the limits [sDetails] => getProductList: )

New code


// removed the fields to return, as theres no need for them

$aParams7 = array( 'iCategoryId' => 97, "bIncludeTree" => true);
$oResponse= $oClient->call('getProductList', $aParams7);

$iTotalCount = $oResponse->iTotalCount; // get the total count before the next call

$aParams17 = array('iLimit' => $iTotalCount, 'iCategoryId' => 97, "bIncludeTree" => true); // use => for the parameters not ->
$oResponse1= $oClient->call('getProductList', $aParams17);

print_r($oResponse1); // It's not really a useful method to echo an array


As I said, in reality this code will just throw an error, but the concept is good.

swathi.somaraj
18-09-09, 08:03
is there any chance to increase this limit?

currentstyle
18-09-09, 15:08
Again, in theory it's possible with some php coding;

Get the total count, divide it by 100, run a loop of calls limited by the result of totalcount/100.

This could take a long time on large merchants, and will eat up your quota pretty quickly.

Why not try paging the results instead?