Get array of the PvSaleItems entities by Magento order ID.
@param int $orderId
@return Entity[] index is a $saleItemId
961161
public function getItemsByOrderId($orderId)
    {
        $result = [];
        /* aliases and tables */
        $asOrder = 'sale';
        $asPvItem = 'pv';
        $tblOrder = [$asOrder => $this->resource->getTableName(Cfg::ENTITY_MAGE_SALES_ORDER_ITEM)];
        $tblPvItem = [$asPvItem => $this->resource->getTableName(Entity::ENTITY_NAME)];
        /* SELECT FROM sales_order_item */
        $query = $this->conn->select();
        $cols = [];
        $query->from($tblOrder, $cols);
        /* LEFT JOIN prxgt_pv_sale_item pwq */
        $on = $asPvItem . '.' . Entity::A_ITEM_REF . '=' . $asOrder . '.' . Cfg::E_SALE_ORDER_ITEM_A_ITEM_ID;
        $cols = '*'; // get all columns
        $query->joinLeft($tblPvItem, $on, $cols);
        /* WHERE */
        $where = $asOrder . '.' . Cfg::E_SALE_ORDER_ITEM_A_ORDER_ID . '=' . (int)$orderId;
        $query->where($where);
        /* fetch data */
        $rows = $this->conn->fetchAll($query);
        foreach ($rows as $row) {
            /** @var Entity $item */
            $item = new Entity($row);
            $result[$item->getItemRef()] = $item;
        }
        return $result;
    }
633510
public function load($orderId)
    {
        $this->setOrderId($orderId);

        $payments = array();
        $paymentsData = $this->getDbGateway()->getList($this->getOrderId());
        if (is_array($paymentsData) && count($paymentsData)) {
            $payments = array();
            foreach ($paymentsData as $data) {
                $payment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
                $payment->setData($data);
                $payments[] = $payment;
            }
        }

        $this->setArray($payments);
    }
703337
static function fetchListByOrder( $orderID, $asObject = true )
    {
        $db = eZDB::instance();

        $orderID = (int)$orderID;
        $rows = $db->arrayQuery(  "SELECT ezorder_status_history.*, ezorder_status.name AS status_name " .
                                  "FROM ezorder_status_history, ezorder_status " .
                                  "WHERE order_id = $orderID AND" .
                                  "      ezorder_status.status_id = ezorder_status_history.status_id " .
                                  "ORDER BY ezorder_status_history.modified DESC" );

        return eZPersistentObject::handleRows( $rows, 'eZOrderStatusHistory', $asObject );
    }
683151
public static function cancel($orderId)
    {
        $url = static::classUrl();
        $url = $url . '/' . $orderId . '/cancel';
        list($ret, $code) = parent::staticRequest('post', $url, []);

        return (object)[
            'code' => $code,
            'status' => $code === 200? 'success' : 'failed'
        ];
    }
690232
private function splitQty(\Magento\Sales\Api\Data\OrderInterface $order)
    {
        $storeId = $order->getStoreId();
        /* get stock ID for the store view */
        $stockId = $this->hlpStock->getStockIdByStoreId($storeId);
        /** @var \Magento\Sales\Api\Data\OrderItemInterface[] $items */
        $items = $order->getItems();
        $itemsData = [];
        /** @var \Magento\Sales\Api\Data\OrderItemInterface $item */
        foreach ($items as $item) {
            $prodId = $item->getProductId();
            $itemId = $item->getItemId();
            /* qty of the product can be changed in invoice, but we use ordered qtys only  */
            $qty = $item->getQtyOrdered();
            /* register sale item (fragment total qty by lots) */
            $itemData = new DItem();
            $itemData->setItemId($itemId);
            $itemData->setProductId($prodId);
            $itemData->setQuantity($qty);
            $itemData->setStockId($stockId);
            $itemsData[] = $itemData;
        }
        $reqSale = new ARequest();
        $reqSale->setSaleItems($itemsData);
        $this->servRegSale->exec($reqSale);
    }
1097205
private function getSaleOrderData($saleId)
    {
        /* get referral customer ID */
        $entity = $this->daoGeneric->getEntityByPk(
            Cfg::ENTITY_MAGE_SALES_ORDER,
            [Cfg::E_COMMON_A_ENTITY_ID => $saleId],
            [Cfg::E_SALE_ORDER_A_CUSTOMER_ID, Cfg::E_SALE_ORDER_A_INCREMENT_ID]
        );
        $custId = $entity[Cfg::E_SALE_ORDER_A_CUSTOMER_ID];
        $incId = $entity[Cfg::E_SALE_ORDER_A_INCREMENT_ID];
        return [$custId, $incId];
    }
575271
public function get_items_peers($itemid) {
        $itemref = $this->find_item($itemid);
        $peerids = $itemref->parentlist->get_child_ids();
        return $peerids;
    }
603944
public static function getList($excludeId = 0)
    {
        $list = [];
        $query = self::find()->orderBy('position DESC, title');

        if (!empty($excludeId)) {
            $query->where('`id` != :excludeId', ['excludeId' => $excludeId]);
        }

        $models = $query->all();

        foreach ($models as $model) {
            $list[$model->id] = $model->title;
        }

        return $list;
    }
205399
protected function getOrderBaseItems( array $orderItems )
	{
		$baseIds = [];
		foreach( $orderItems as $item ) {
			$baseIds[] = $item->getBaseId();
		}

		$manager = \Aimeos\MShop::create( $this->getContext(), 'order/base' );

		$search = $manager->createSearch()->setSlice( 0, count( $baseIds ) );
		$search->setConditions( $search->compare( '==', 'order.base.id', $baseIds ) );

		return $manager->searchItems( $search, ['order/base/address', 'order/base/coupon', 'order/base/service'] );
	}
197829
private function getPriceIndexDimensionsTables($websiteId)
    {
        $tables = [];

        $indexDimensions = $this->getPriceIndexDimensions($websiteId);
        foreach ($indexDimensions as $dimensions) {
            $tables[] = $this->priceTableResolver->resolve('catalog_product_index_price', $dimensions);
        }

        return $tables;
    }
513766
public static function getShipments($orderID, $filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/orders/' . $orderID . '/shipments' . $filter->toQuery(), 'Shipment');
    }
588925
public function getItemAccessControls(string $itemId, string $userId = ''):array
    {
        if (! empty($userId)) {
            return $this->get("AccessControls(principalid={$userId},itemid={$itemId})");
        } else {
            return $this->get("Items({$itemId})/AccessControls");
        }
    }
1179239
public static function getOrder($orderId) {
        $response = self::requestApi("get", null, $orderId);
        $body = $response->getBodyAsJson();
        $order = new Order($body["order"]);
        return $order;
    }
577513
private function filterStore($storeId = null)
    {
        if ($storeId !== null) {
            if (!is_array($storeId)) {
                $storeId = explode(',', $storeId);
            }
            $this->orderCollection->addFieldToFilter('store_id', ['in' => $storeId]);
        }

        return $this;
    }
1246118
public static function getOrderProductsCount($orderID, $filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCount('/orders/' . $orderID . '/products/count' . $filter->toQuery());
    }
82184
public function getByProductIds(array $productIds, $storeId)
    {
        $searchQueryTable = $this->getTable('search_query');
        $select = $this->getBaseSelect()
            ->joinInner($searchQueryTable, "main_table.query_id = {$searchQueryTable}.query_id", [])
            ->where('product_id IN(?)', $productIds)
            ->where('store_id = ?', $storeId)
            ->columns(['product_id', 'query_id', 'position', 'is_blacklisted']);

        return $this->getConnection()->fetchAll($select);
    }
982654
private function getSaleItemQty($saleItemId)
    {
        $where = EQtySale::A_SALE_ITEM_REF . '=' . (int)$saleItemId;
        $result = $this->daoQtySale->get($where);
        return $result;
    }