client/html/src/Client/Html/Catalog/Count/Tree/Standard.php
protected function traverse( \Aimeos\MShop\Catalog\Item\Iface $node, array $counts )
	{
		$count = ( isset( $counts[$node->getId()] ) ? $counts[$node->getId()] : 0 );

		foreach( $node->getChildren() as $child ) {
			$count += $this->traverse( $child, $counts )->count;
		}

		$node->count = $count;
		return $node;
	}
protected function traverse( \Aimeos\MShop\Catalog\Item\Iface $node, array $counts )
	{
		$count = ( isset( $counts[$node->getId()] ) ? $counts[$node->getId()] : 0 );

		foreach( $node->getChildren() as $child ) {
			$count += $this->traverse( $child, $counts )->count;
		}

		$node->count = $count;
		return $node;
	}
protected function traverse ( \ Aimeos \ MShop \ Catalog \ Item \ Iface $ node , array $ counts ) { $ count = ( isset ( $ counts [ $ node -> getId ( ) ] ) ? $ counts [ $ node -> getId ( ) ] : 0 ) ; foreach ( $ node -> getChildren ( ) as $ child ) { $ count += $ this -> traverse ( $ child , $ counts ) -> count ; } $ node -> count = $ count ; return $ node ; }
Traverses the tree and adds the aggregated product counts to each node

@param \Aimeos\MShop\Catalog\Item\Iface $node Tree node, maybe with children
@param array $counts Associative list of catalog IDs as keys and product counts as values
@return \Aimeos\MShop\Catalog\Item\Iface Updated tree node
Traverses the tree and adds the aggregated product counts to each node