Load prices data for a list of product ids and a given store.

@param integer $storeId    Store id.
@param array   $productIds Product ids list.

@return array
763483
public function loadPriceData($storeId, $productIds)
    {
        $websiteId = $this->getStore($storeId)->getWebsiteId();

        $baseSelects = [];
        foreach ($this->getPriceIndexDimensionsTables($websiteId) as $dimensionsTable) {
            $baseSelects[] = $this->getLoadPriceDataSelect($dimensionsTable, $websiteId, $productIds);
        }
        $select = $this->getConnection()->select()->union($baseSelects);

        return $this->getConnection()->fetchAll($select);
    }
569007
public function loadByTransactionId($transactionId)
    {
        $db = $this->getDb();
        $data = $db->getRow('SELECT * FROM `oepaypal_orderpayments` WHERE `oepaypal_transactionid` = ' . $db->quote($transactionId));

        return $data;
    }
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);
    }
1250215
public function getItems($product_id)
    {
        $product_ids = array();
        foreach ($this->getList(array('product_id' => $product_id)) as $item) {
            $product_ids[] = $item['item_product_id'];
        }

        return $product_ids;
    }
1264432
public function getActiveCarriers($storeId = null)
    {
        return $this->carrierConfig->getActiveCarriers($this->storeManager->getStore($storeId));
    }
1007553
private function getCategoryNameById($categoryId, $storeId)
    {
        if (!isset($this->categoryNames[$categoryId])) {
            $categoryResource = $this->categoryResource;
            $this->categoryNames[$categoryId] = $categoryResource->getAttributeRawValue($categoryId, "name", $storeId);
        }

        return $this->categoryNames[$categoryId];
    }
298248
public function findOne($productId)
    {
        $this->useAlternateEndpoint = true;
        $this->queryParams['ProductIds'] = $productId;
        $this->addAllProductImages();
        $this->addAllShopLogos();
        $response = $this->send();
        $products = $response->getProducts();
        if (isset($products[0])) {
            return $products[0];
        }

        return null;
    }
248318
protected function getCategoryProductSelect($productIds, $storeId)
    {
        $select = $this->getConnection()->select()
            ->from(['cpi' => $this->getTable($this->getCategoryProductIndexTable($storeId))])
            ->where('cpi.store_id = ?', $storeId)
            ->where('cpi.product_id IN(?)', $productIds);

        return $select;
    }
1019051
public function loadItemData($itemId, int $status): array
    {
        $query = $this->getItemSelectQuery();
        $query->where(
            $query->expr()->eq('id', ':id')
        )
        ->setParameter('id', $itemId, Type::INTEGER);

        $this->applyStatusCondition($query, $status);

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
34177
public function loadChildrens($productIds, $storeId)
    {
        $children = [];

        foreach ($this->catalogProductType->getCompositeTypes() as $productTypeId) {
            $typeInstance = $this->getProductTypeInstance($productTypeId);
            $relation = $typeInstance->getRelationInfo();

            if ($relation->getTable() && $relation->getParentFieldName() && $relation->getChildFieldName()) {
                $select = $this->getRelationQuery($relation, $productIds, $storeId);
                $data   = $this->getConnection()->fetchAll($select);

                foreach ($data as $relationRow) {
                    $parentId = (int) $relationRow['parent_id'];
                    $childId  = (int) $relationRow['child_id'];
                    $sku      = (string) $relationRow['sku'];
                    $configurableAttributes = array_filter(explode(',', $relationRow["configurable_attributes"]));
                    $children[$childId][] = [
                        "parent_id"               => $parentId,
                        "configurable_attributes" => $configurableAttributes,
                        "sku"                     => $sku,
                    ];
                }
            }
        }

        return $children;
    }
559727
public function getSynonyms($storeId)
    {
        $connection = $this->getConnection();
        $select     = $this->getBaseSelect($storeId, ThesaurusInterface::TYPE_SYNONYM);

        $select->columns(['terms' => new \Zend_Db_Expr('GROUP_CONCAT(terms.term)')]);

        return $connection->fetchCol($select);
    }
1026101
public function findByAttributeIdAndProductId($attributeId, $productId)
    {
        try {
            $queryBuilder = $this->createQueryBuilder('productAttribute')
                ->leftJoin('productAttribute.attribute', 'attribute')
                ->leftJoin('productAttribute.product', 'product')
                ->andWhere('attribute.id = :attributeId')
                ->andWhere('product.id = :productId')
                ->setParameter('attributeId', $attributeId)
                ->setParameter('productId', $productId);

            return $queryBuilder->getQuery()->getSingleResult();
        } catch (NoResultException $exc) {
            return null;
        }
    }
1208964
private function addAttributeData($storeId, $productIds, $indexData = [])
    {
        foreach ($this->attributeIdsByTable as $backendTable => $attributeIds) {
            $attributesData = $this->loadAttributesRawData($storeId, $productIds, $backendTable, $attributeIds);
            foreach ($attributesData as $row) {
                $productId    = (int) $row['entity_id'];
                $attribute    = $this->attributesById[$row['attribute_id']];
                $indexValues  = $this->attributeHelper->prepareIndexValue($attribute, $storeId, $row['value']);
                if (!isset($indexData[$productId])) {
                    $indexData[$productId] = [];
                }

                $indexData[$productId] += $indexValues;

                $this->addIndexedAttribute($indexData[$productId], $attribute);
            }
        }

        return $indexData;
    }
1063438
public function getPrefetchAddressFields($storeId = null)
    {
        return $this->getScopeConfig()->getValue(
            self::XML_PATH_PREFETCH_ADDRESS_FIELDS,
            ScopeInterface::SCOPE_STORE,
            $storeId
        );
    }
1374001
public function loadProductById($productId)
    {
        $collection = $this->catalogCollection->create()
            ->addFieldToFilter('product_id', $productId)
            ->setPageSize(1);

        return $collection->getFirstItem();
    }
611107
private function isPopularQuery($queryId, $storeId)
    {
        $popularQueryIds = $this->queryCollection
            ->setPopularQueryFilter($storeId)
            ->setPageSize($this->getMaxCountCacheableSearchTerms($storeId))
            ->load()
            ->getColumnValues('query_id');

        return count(array_intersect([$queryId], $popularQueryIds)) > 0 ;
    }
302329
public function getPriceStockForQuantityAction($productId)
    {
        $request = $this->getCurrentRequest();
        if (!$request->isXmlHttpRequest() || !($quantity = (int) $request->query->get('quantity'))) {
            throw new BadRequestHttpException('Request needs to be XHR and have a quantity parameter');
        }

        $product = $this->get('sonata.product.set.manager')->findOneBy(['id' => $productId, 'enabled' => true]);

        if (!$product) {
            throw new NotFoundHttpException(sprintf('Unable to find the product with id=%d', $productId));
        }

        $errors = [];

        /** @var \Sonata\Component\Product\Pool $productPool */
        $productPool = $this->get('sonata.product.pool');
        $provider = $productPool->getProvider($product);

        if ($provider->hasVariations($product)) {
            $errors['variations'] = 'This is a master product, it has no price';
        }

        $stock = $provider->getStockAvailable($product) ?: 0;

        if ($quantity > $stock) {
            $errors['stock'] = $this->get('translator')->trans('product_out_of_stock_quantity', [], 'SonataProductBundle');
        }

        $currency = $this->get('sonata.basket')->getCurrency();

        $price = $provider->calculatePrice($product, $currency, true, $quantity);

        return new JsonResponse([
            'stock' => $stock,
            'price' => $price,
            'price_text' => $this->get('sonata.intl.templating.helper.number')->formatCurrency($price, $currency),
            'errors' => $errors,
        ]);
    }