source/Application/Model/ArticleList.php
protected function _getFilterIdsSql($sCatId, $aFilter)
    {
        $sO2CView = getViewName('oxobject2category');
        $sO2AView = getViewName('oxobject2attribute');

        $sFilter = '';
        $iCnt = 0;

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        foreach ($aFilter as $sAttrId => $sValue) {
            if ($sValue) {
                if ($sFilter) {
                    $sFilter .= ' or ';
                }
                $sValue = $oDb->quote($sValue);
                $sAttrId = $oDb->quote($sAttrId);

                $sFilter .= "( oa.oxattrid = {$sAttrId} and oa.oxvalue = {$sValue} )";
                $iCnt++;
            }
        }
        if ($sFilter) {
            $sFilter = "WHERE $sFilter ";
        }

        $sFilterSelect = "select oc.oxobjectid as oxobjectid, count(*) as cnt from ";
        $sFilterSelect .= "(SELECT * FROM $sO2CView WHERE $sO2CView.oxcatnid = '$sCatId' GROUP BY $sO2CView.oxobjectid, $sO2CView.oxcatnid) as oc ";
        $sFilterSelect .= "INNER JOIN $sO2AView as oa ON ( oa.oxobjectid = oc.oxobjectid ) ";

        return $sFilterSelect . "{$sFilter} GROUP BY oa.oxobjectid HAVING cnt = $iCnt ";
    }
protected function _getFilterIdsSql($sCatId, $aFilter)
    {
        $sO2CView = getViewName('oxobject2category');
        $sO2AView = getViewName('oxobject2attribute');

        $sFilter = '';
        $iCnt = 0;

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        foreach ($aFilter as $sAttrId => $sValue) {
            if ($sValue) {
                if ($sFilter) {
                    $sFilter .= ' or ';
                }
                $sValue = $oDb->quote($sValue);
                $sAttrId = $oDb->quote($sAttrId);

                $sFilter .= "( oa.oxattrid = {$sAttrId} and oa.oxvalue = {$sValue} )";
                $iCnt++;
            }
        }
        if ($sFilter) {
            $sFilter = "WHERE $sFilter ";
        }

        $sFilterSelect = "select oc.oxobjectid as oxobjectid, count(*) as cnt from ";
        $sFilterSelect .= "(SELECT * FROM $sO2CView WHERE $sO2CView.oxcatnid = '$sCatId' GROUP BY $sO2CView.oxobjectid, $sO2CView.oxcatnid) as oc ";
        $sFilterSelect .= "INNER JOIN $sO2AView as oa ON ( oa.oxobjectid = oc.oxobjectid ) ";

        return $sFilterSelect . "{$sFilter} GROUP BY oa.oxobjectid HAVING cnt = $iCnt ";
    }
protected function _getFilterIdsSql ( $ sCatId , $ aFilter ) { $ sO2CView = getViewName ( 'oxobject2category' ) ; $ sO2AView = getViewName ( 'oxobject2attribute' ) ; $ sFilter = '' ; $ iCnt = 0 ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; foreach ( $ aFilter as $ sAttrId => $ sValue ) { if ( $ sValue ) { if ( $ sFilter ) { $ sFilter .= ' or ' ; } $ sValue = $ oDb -> quote ( $ sValue ) ; $ sAttrId = $ oDb -> quote ( $ sAttrId ) ; $ sFilter .= "( oa.oxattrid = {$sAttrId} and oa.oxvalue = {$sValue} )" ; $ iCnt ++ ; } } if ( $ sFilter ) { $ sFilter = "WHERE $sFilter " ; } $ sFilterSelect = "select oc.oxobjectid as oxobjectid, count(*) as cnt from " ; $ sFilterSelect .= "(SELECT * FROM $sO2CView WHERE $sO2CView.oxcatnid = '$sCatId' GROUP BY $sO2CView.oxobjectid, $sO2CView.oxcatnid) as oc " ; $ sFilterSelect .= "INNER JOIN $sO2AView as oa ON ( oa.oxobjectid = oc.oxobjectid ) " ; return $ sFilterSelect . "{$sFilter} GROUP BY oa.oxobjectid HAVING cnt = $iCnt " ; }
Returns sql to fetch ids of articles fitting current filter

@param string $sCatId  category id
@param array  $aFilter filters for this category

@return string
Returns sql to fetch ids of articles fitting current filter