source/Core/UtilsCount.php
public function setCatArticleCount($aCache, $sCatId, $sActIdent)
    {
        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        $sTable = $oArticle->getViewName();
        $sO2CView = getViewName('oxobject2category');
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        // we use distinct if article is assigned to category twice
        $sQ = "SELECT COUNT( DISTINCT $sTable.`oxid` )
               FROM $sO2CView
                   INNER JOIN $sTable ON $sO2CView.`oxobjectid` = $sTable.`oxid` AND $sTable.`oxparentid` = ''
               WHERE $sO2CView.`oxcatnid` = " . $oDb->quote($sCatId) . " AND " . $oArticle->getSqlActiveSnippet();

        $aCache[$sCatId][$sActIdent] = $oDb->getOne($sQ);

        $this->_setCatCache($aCache);

        return $aCache[$sCatId][$sActIdent];
    }
public function setCatArticleCount($aCache, $sCatId, $sActIdent)
    {
        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        $sTable = $oArticle->getViewName();
        $sO2CView = getViewName('oxobject2category');
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        // we use distinct if article is assigned to category twice
        $sQ = "SELECT COUNT( DISTINCT $sTable.`oxid` )
               FROM $sO2CView
                   INNER JOIN $sTable ON $sO2CView.`oxobjectid` = $sTable.`oxid` AND $sTable.`oxparentid` = ''
               WHERE $sO2CView.`oxcatnid` = " . $oDb->quote($sCatId) . " AND " . $oArticle->getSqlActiveSnippet();

        $aCache[$sCatId][$sActIdent] = $oDb->getOne($sQ);

        $this->_setCatCache($aCache);

        return $aCache[$sCatId][$sActIdent];
    }
public function setCatArticleCount ( $ aCache , $ sCatId , $ sActIdent ) { $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ sTable = $ oArticle -> getViewName ( ) ; $ sO2CView = getViewName ( 'oxobject2category' ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; // we use distinct if article is assigned to category twice $ sQ = "SELECT COUNT( DISTINCT $sTable.`oxid` )
               FROM $sO2CView
                   INNER JOIN $sTable ON $sO2CView.`oxobjectid` = $sTable.`oxid` AND $sTable.`oxparentid` = ''
               WHERE $sO2CView.`oxcatnid` = " . $ oDb -> quote ( $ sCatId ) . " AND " . $ oArticle -> getSqlActiveSnippet ( ) ; $ aCache [ $ sCatId ] [ $ sActIdent ] = $ oDb -> getOne ( $ sQ ) ; $ this -> _setCatCache ( $ aCache ) ; return $ aCache [ $ sCatId ] [ $ sActIdent ] ; }
Saves and returns category article count into cache

@param array  $aCache    Category cache data
@param string $sCatId    Unique category identifier
@param string $sActIdent ID

@return int
Saves and returns category article count into cache