PDA

View Full Version : Different API calls return different product counts - why?


authcode
08-06-08, 17:17
I've come across a problem that I've managed to narrow down to this:

the product count returned from getCategoryTree - iLocalCount is different from that returned from getProductList - iTotalCount for some categories.

Why is this? In some cases the difference is in double figures which makes doing what I'm doing extremely unreliable.

Am I wrong in assuming these values should be identical? What is the reason for the difference?

Example Code:
$oClient = new api_client();

$aCategoryTreeParams = array('iCategoryId' => 129, 'bIncludeDescendants' => true, 'bIncludeEmptyCats' => false, 'bIncludeCounts' => true, 'sRelationship' => 'biological');
$oCategoryTree = $oClient->call('getCategoryTree', $aCategoryTreeParams);
echo 'Cat: '.$oCategoryTree->getCategoryTreeReturn[1]->iId.' / iLocalCount: '.$oCategoryTree->getCategoryTreeReturn[1]->iLocalCount;

echo '<br />';

$aProductListParams = array('iCategoryId' => 539, 'sSort' => 'popular', 'iLimit' => 1, 'iOffset' => 0, 'bIncludeDescendants' => true);
$oProductList = $oClient->call('getProductList', $aProductListParams);
echo 'Cat: '.$oProductList->getProductListReturn[0]->iCategoryId.' / iTotalCount: '.$oProductList->iTotalCount;

Output:
Cat: 539 / iLocalCount: 878
Cat: 539 / iTotalCount: 862