Return the order clause.

@return string
348979
public function order($query)
    {
        $clause = '';

        if (!empty($query->order)) {
            $clause = 'ORDER BY ';
            $list = array();
            foreach ($query->order as $order) {
                $columns = AnDomainQueryHelper::parseColumns($query, $order['column']);
                foreach ($columns as $column) {
                    $list[] = $column.' '.$order['direction'];
                }
            }

            $clause .= implode(' , ', $list);
        }

        return $clause;
    }
831513
protected function _getSorting()
    {
        $sOxIdParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
        $sSynchOxidParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
        if ($sOxIdParameter && !$sSynchOxidParameter) {
            return 'order by oxactions2article.oxsort ';
        }

        return parent::_getSorting();
    }
350739
public function ordering()
    {
        if ($this->orderCallback) {
            return call_user_func($this->orderCallback, $this->resolveCallbackParameter());
        }

        return $this->defaultOrdering();
    }
1297181
protected function buildOrderby() {
		if(!$this->orderBy || !$this->orderBy[0])
			return ['', []];

		$res = [];

		$orderBy = $this->orderBy;
		$orderBySql = $orderBy[0];
		$orderByParameters = $orderBy[1];

		foreach(explode(',', $orderBySql) as $orderbystr) {
			$orderbystr = trim($orderbystr);

			preg_match('/(.*?) (ASC|DESC)?$/i', $orderbystr, $matches);

			if(isset($matches[2])) {
				$direction = $matches[2];
				$column = $matches[1];

				if($this->isIdentifier($column))
					$res[] = $this->replace($column).' '.$direction;
				else
					$res[] = $column.' '.$direction;
			}
			else {
				$column = $orderbystr;

				if($this->isIdentifier($column))
					$res[] = $this->replace($column);
				else
					$res[] = $column;
			}
		}

		$sql = "\n".'ORDER BY '.implode(', ', $res);

		return [$sql, $orderByParameters];
	}
206340
public function getOrderTableDescription()
    {
        $salesTable = $this->adapter->getTableName('sales_order');
        $adapter = $this->adapter->getConnection('sales');
        $columns = $adapter->describeTable($salesTable);

        return $columns;
    }
1289758
public function getOrdersToPrepare()
    {
        $res = $this->createQueryBuilder('o')
            ->innerJoin('o.shippingLastStateLine', 'sl')
            ->where('sl.name = \'preparing\'')
            ->orderBy('o.updatedAt', 'ASC')
            ->getQuery()
            ->getResult();

        return $res;
    }
1146616
public function getOrderLink()
    {
        if (($sValue = $this->getViewConfigParam('orderlink')) === null) {
            $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
            $this->setViewConfigParam('orderlink', $sValue);
        }

        return $sValue;
    }
294411
public function getOrderTotalLines()
    {
        if (!$this->orderTotalLines) {
            $orderModel = $this->getRegistry()->getOrderModel();
            $this->orderTotalLines = $orderModel->getOrderTotals($this->source['order_id']);
        }
        return $this->orderTotalLines;
    }
91374
protected function getOrder()
    {
        $order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
        $order->load($this->getSession()->getVariable('sess_challenge'));

        return $order;
    }
230684
protected function getOrderLimitSql() {

		$router = Router::getInstance();
		
		$ret = '';
		
		if ($router->order) {
			$orderOptions = $this->getOrderOptions();
			if (isset($orderOptions[$router->order])) { 
				$ret = ' ORDER BY ' . $orderOptions[$router->order];
			}
		}

		$ret .= ' LIMIT ' . $this->pagination->start . ', ' . $this->pagination->limit;
		
		return $ret;
		
	}
224367
protected function getTotalLogOrder()
    {
        $conditions = array(
            'count' => true,
            'order_id' => $this->data_order['order_id']
        );

        return (int) $this->order_history->getList($conditions);
    }
26528
public function getListOrderBy()
    {
        //if column is with table name split it
        $columns = explode('.', $this->_sListOrderBy);

        if (is_array($columns) && count($columns) > 1) {
            return $columns[1];
        }

        return $this->_sListOrderBy;
    }
348160
protected function getOrder()
    {
        if (null === $this->order) {
            $this->order = $this->getSession() ? $this->getSession()->getOrder() : null;
        }

        return $this->order;
    }
47144
protected function getOrderQuery( $orders = array() )
	{
		if( is_array( $orders ) && count( $orders ) )
		{
			$order = array();
			foreach( $orders as $key => $value )
				$order[] = $key.' '.$value;
			$orders = ' ORDER BY '.implode( ', ', $order );
		}
		else
			$orders = '';
		return $orders;
	}
679817
protected function _getSorting()
    {
        $sOrder = '';
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid')) {
            $sOrder = parent::_getSorting();
        } elseif (($aSkipArt = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('neworder_sess'))) {
            $sOrderBy = '';
            $sArtTable = $this->_getViewName('oxarticles');
            $sSep = '';
            foreach ($aSkipArt as $sId) {
                $sOrderBy = " $sArtTable.oxid=" . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sId) . " " . $sSep . $sOrderBy;
                $sSep = ", ";
            }
            $sOrder = "order by " . $sOrderBy;
        }

        return $sOrder;
    }
1111687
protected function buildOrder()
    {
        $result = '';

        $orders = (array) $this->getOrder();
        foreach ($orders as $field => $direction) {
            if ($result != '') {
                $result.=',';
            }
            $result.=$field.' '.($direction === SORT_DESC ? 'DESC' : 'ASC');
        }
        if ($result != '') {
            $result = 'ORDER BY '.$result;
        }

        return $result;
    }
245947
public function get_sql_sort() {
        $columns = $this->get_sort_columns();
        if (count($columns) == 1 && isset($columns['timemodified']) && $columns['timemodified'] == SORT_DESC) {
            // Add the 'id' column when we are using the default sorting.
            $columns['id'] = SORT_DESC;
            return self::construct_order_by($columns);
        }
        return parent::get_sql_sort();
    }