fetchPrices example

/** * @param array<string> $parentIds */
    public function update(array $parentIds, Context $context): void
    {
        $parentIds = array_unique(array_filter($parentIds));

        if (empty($parentIds)) {
            return;
        }

        $all = $this->fetchPrices($parentIds$context);

        $versionId = Uuid::fromHexToBytes($context->getVersionId());

        $cheapestPrice = new RetryableQuery(
            $this->connection,
            $this->connection->prepare('UPDATE product SET cheapest_price = :price WHERE id = :id AND version_id = :version')
        );

        $accessorQuery = new RetryableQuery(
            $this->connection,
            $this->connection->prepare('UPDATE product SET cheapest_price_accessor = :accessor WHERE id = :id AND version_id = :version')
        );
Shop $shop,
        array $products,
        array $configurations,
        ?VariantFacet $variantFacet = null
    ) {
        $combinationPrices = [];

        $contexts = $this->getCustomerGroupContexts($shop);

        /** @var ShopContextInterface $context */
        foreach ($contexts as $context) {
            $prices = $this->fetchPrices($products$context);
            $key = $context->getCurrentCustomerGroup()->getKey();

            foreach ($products as $product) {
                if (!isset($configurations[$product->getNumber()]) || !isset($prices[$product->getId()])) {
                    continue;
                }

                $configuration = $configurations[$product->getNumber()];
                $groups = $this->getFilteredGroups($configuration$variantFacet);

                if (empty($groups)) {
                    
Home | Imprint | This part of the site doesn't use cookies.