source/Application/Model/ArticleList.php
protected function _getCategorySelect($sFields, $sCatId, $aSessionFilter)
    {
        $sArticleTable = getViewName('oxarticles');
        $sO2CView = getViewName('oxobject2category');

        // ----------------------------------
        // sorting
        $sSorting = '';
        if ($this->_sCustomSorting) {
            $sSorting = " {$this->_sCustomSorting} , ";
        }

        // ----------------------------------
        // filtering ?
        $sFilterSql = '';
        $iLang = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
        if ($aSessionFilter && isset($aSessionFilter[$sCatId][$iLang])) {
            $sFilterSql = $this->_getFilterSql($sCatId, $aSessionFilter[$sCatId][$iLang]);
        }

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        $sSelect = "SELECT $sFields, $sArticleTable.oxtimestamp FROM $sO2CView as oc left join $sArticleTable
                    ON $sArticleTable.oxid = oc.oxobjectid
                    WHERE " . $this->getBaseObject()->getSqlActiveSnippet() . " and $sArticleTable.oxparentid = ''
                    and oc.oxcatnid = " . $oDb->quote($sCatId) . " $sFilterSql ORDER BY $sSorting oc.oxpos, oc.oxobjectid ";

        return $sSelect;
    }
protected function _getCategorySelect($sFields, $sCatId, $aSessionFilter)
    {
        $sArticleTable = getViewName('oxarticles');
        $sO2CView = getViewName('oxobject2category');

        // ----------------------------------
        // sorting
        $sSorting = '';
        if ($this->_sCustomSorting) {
            $sSorting = " {$this->_sCustomSorting} , ";
        }

        // ----------------------------------
        // filtering ?
        $sFilterSql = '';
        $iLang = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
        if ($aSessionFilter && isset($aSessionFilter[$sCatId][$iLang])) {
            $sFilterSql = $this->_getFilterSql($sCatId, $aSessionFilter[$sCatId][$iLang]);
        }

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        $sSelect = "SELECT $sFields, $sArticleTable.oxtimestamp FROM $sO2CView as oc left join $sArticleTable
                    ON $sArticleTable.oxid = oc.oxobjectid
                    WHERE " . $this->getBaseObject()->getSqlActiveSnippet() . " and $sArticleTable.oxparentid = ''
                    and oc.oxcatnid = " . $oDb->quote($sCatId) . " $sFilterSql ORDER BY $sSorting oc.oxpos, oc.oxobjectid ";

        return $sSelect;
    }
protected function _getCategorySelect ( $ sFields , $ sCatId , $ aSessionFilter ) { $ sArticleTable = getViewName ( 'oxarticles' ) ; $ sO2CView = getViewName ( 'oxobject2category' ) ; // ---------------------------------- // sorting $ sSorting = '' ; if ( $ this -> _sCustomSorting ) { $ sSorting = " {$this->_sCustomSorting} , " ; } // ---------------------------------- // filtering ? $ sFilterSql = '' ; $ iLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; if ( $ aSessionFilter && isset ( $ aSessionFilter [ $ sCatId ] [ $ iLang ] ) ) { $ sFilterSql = $ this -> _getFilterSql ( $ sCatId , $ aSessionFilter [ $ sCatId ] [ $ iLang ] ) ; } $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sSelect = "SELECT $sFields, $sArticleTable.oxtimestamp FROM $sO2CView as oc left join $sArticleTable
                    ON $sArticleTable.oxid = oc.oxobjectid
                    WHERE " . $ this -> getBaseObject ( ) -> getSqlActiveSnippet ( ) . " and $sArticleTable.oxparentid = ''
                    and oc.oxcatnid = " . $ oDb -> quote ( $ sCatId ) . " $sFilterSql ORDER BY $sSorting oc.oxpos, oc.oxobjectid " ; return $ sSelect ; }
Creates SQL Statement to load Articles, etc.

@param string $sFields        Fields which are loaded e.g. "oxid" or "*" etc.
@param string $sCatId         Category tree ID
@param array  $aSessionFilter Like array ( catid => array( attrid => value,...))

@return string SQL
Creates SQL Statement to load Articles etc .