source/Application/Controller/Admin/AdminListController.php
protected function _prepareOrderByQuery($query = null)
    {
        // sorting
        $sortFields = $this->getListSorting();

        if (is_array($sortFields) && count($sortFields)) {
            // only add order by at full sql not for count(*)
            $query .= ' order by ';
            $addSeparator = false;

            $listItem = $this->getItemListBaseObject();
            $languageId = $listItem->isMultilang() ? $listItem->getLanguage() : \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();

            $descending = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('adminorder');
            $descending = $descending !== null ? (bool)$descending : $this->_blDesc;

            foreach ($sortFields as $table => $fieldData) {
                $table = $table ? (getViewName($table, $languageId) . '.') : '';
                foreach ($fieldData as $column => $sortDirectory) {
                    $field = $table . $column;

                    //add table name to column name if no table name found attached to column name
                    $query .= ((($addSeparator) ? ', ' : '')) . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteIdentifier($field);

                    //V oxActive field search always DESC
                    if ($descending || $column == "oxactive" || strcasecmp($sortDirectory, 'desc') == 0) {
                        $query .= ' desc ';
                    }

                    $addSeparator = true;
                }
            }
        }

        return $query;
    }
protected function _prepareOrderByQuery($query = null)
    {
        // sorting
        $sortFields = $this->getListSorting();

        if (is_array($sortFields) && count($sortFields)) {
            // only add order by at full sql not for count(*)
            $query .= ' order by ';
            $addSeparator = false;

            $listItem = $this->getItemListBaseObject();
            $languageId = $listItem->isMultilang() ? $listItem->getLanguage() : \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();

            $descending = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('adminorder');
            $descending = $descending !== null ? (bool)$descending : $this->_blDesc;

            foreach ($sortFields as $table => $fieldData) {
                $table = $table ? (getViewName($table, $languageId) . '.') : '';
                foreach ($fieldData as $column => $sortDirectory) {
                    $field = $table . $column;

                    //add table name to column name if no table name found attached to column name
                    $query .= ((($addSeparator) ? ', ' : '')) . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteIdentifier($field);

                    //V oxActive field search always DESC
                    if ($descending || $column == "oxactive" || strcasecmp($sortDirectory, 'desc') == 0) {
                        $query .= ' desc ';
                    }

                    $addSeparator = true;
                }
            }
        }

        return $query;
    }
protected function _prepareOrderByQuery ( $ query = null ) { // sorting $ sortFields = $ this -> getListSorting ( ) ; if ( is_array ( $ sortFields ) && count ( $ sortFields ) ) { // only add order by at full sql not for count(*) $ query .= ' order by ' ; $ addSeparator = false ; $ listItem = $ this -> getItemListBaseObject ( ) ; $ languageId = $ listItem -> isMultilang ( ) ? $ listItem -> getLanguage ( ) : \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; $ descending = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'adminorder' ) ; $ descending = $ descending !== null ? ( bool ) $ descending : $ this -> _blDesc ; foreach ( $ sortFields as $ table => $ fieldData ) { $ table = $ table ? ( getViewName ( $ table , $ languageId ) . '.' ) : '' ; foreach ( $ fieldData as $ column => $ sortDirectory ) { $ field = $ table . $ column ; //add table name to column name if no table name found attached to column name $ query .= ( ( ( $ addSeparator ) ? ', ' : '' ) ) . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteIdentifier ( $ field ) ; //V oxActive field search always DESC if ( $ descending || $ column == "oxactive" || strcasecmp ( $ sortDirectory , 'desc' ) == 0 ) { $ query .= ' desc ' ; } $ addSeparator = true ; } } } return $ query ; }
Adds order by to SQL query string.

@param string $query sql string

@return string
Adds order by to SQL query string .