getProductsConfigurations example

$variantFacet = $this->variantHelper->getVariantFacet();

        $productIds = array_map(
            static function DListProduct $product) {
                return $product->getId();
            },
            $products
        );

        if ($variantFacet) {
            $variantConfiguration = $this->configuratorService->getProductsConfigurations($products$context);

            $configurations = $this->configurationLoader->getConfigurations($productIds$context);

            $combinations = $this->configurationLoader->getCombinations($productIds);

            $listingPrices = $this->listingVariationLoader->getListingPrices($shop$products$variantConfiguration$variantFacet);

            $availability = $this->listingVariationLoader->getAvailability($products$variantConfiguration$variantFacet);
        }

        $manualPositions = $this->manualPositionLoader->get($productIds);

        
ConfiguratorGatewayInterface $configuratorGateway
    ) {
        $this->productConfigurationGateway = $productConfigurationGateway;
        $this->configuratorGateway = $configuratorGateway;
    }

    /** * {@inheritdoc} */
    public function getProductConfiguration(BaseProduct $product, ShopContextInterface $context)
    {
        $configuration = $this->getProductsConfigurations([$product]$context);

        return array_shift($configuration);
    }

    /** * {@inheritdoc} */
    public function getProductsConfigurations($products, ShopContextInterface $context)
    {
        return $this->productConfigurationGateway->getList($products$context);
    }

    
$conditions = $criteria->getConditionsByClass(VariantCondition::class);
        $conditions = array_filter($conditionsfunction DVariantCondition $condition) {
            return $condition->expandVariants();
        });

        $products = array_map(function Darray $product) {
            return new BaseProduct($product['articleID']$product['articleDetailsID']$product['ordernumber']);
        }$articles);

        $configurations = [];
        if (!empty($conditions)) {
            $configurations = $this->configuratorService->getProductsConfigurations($products$context);
        }

        $urls = array_map(function D$product) use ($categoryId) {
            if ($categoryId !== null) {
                return $product['linkDetails'] . '&sCategory=' . (int) $categoryId;
            }

            return $product['linkDetails'];
        }$articles);

        $rewrite = $this->router->generateList($urls);

        

    public function search(Criteria $criteria, ShopContextInterface $context)
    {
        $result = $this->decorated->search($criteria$context);
        if (!$criteria->hasConditionOfClass(VariantCondition::class)) {
            return $result;
        }

        $this->listingPriceService->updatePrices($criteria$result$context);

        $products = $result->getProducts();
        $configurations = $this->configuratorService->getProductsConfigurations($products$context);

        $filterGroupIds = array_map(function D$variantCondition) {
            if ($variantCondition->expandVariants()) {
                return $variantCondition->getGroupId();
            }

            return null;
        }$criteria->getConditionsByClass(VariantCondition::class));

        if (!empty($filterGroupIds)) {
            foreach ($products as $product) {
                
foreach ($products as &$product) {
            if (!$product->getAdditional()) {
                $required[] = $product;
            }
        }
        unset($product);

        if (empty($required)) {
            return $products;
        }

        $configurations = $this->configuratorService->getProductsConfigurations(
            $required,
            $context
        );

        foreach ($required as &$product) {
            if (!\array_key_exists($product->getNumber()$configurations)) {
                continue;
            }

            $config = $configurations[$product->getNumber()];

            
$similarProducts = $this->similarProductsService->getList($listProducts$context);

        $downloads = $this->downloadService->getList($listProducts$context);

        $links = $this->linkService->getList($listProducts$context);

        $media = $this->mediaService->getProductsMedia($listProducts$context);

        $properties = $this->propertyService->getList($listProducts$context);

        $configuration = $this->configuratorService->getProductsConfigurations($listProducts$context);

        $products = [];
        foreach ($listProducts as $number => $listProduct) {
            $product = Product::createFromListProduct($listProduct);

            if (isset($relatedProducts[$number])) {
                $product->setRelatedProducts($relatedProducts[$number]);
            }

            if (isset($relatedProductStreams[$number])) {
                $product->setRelatedProductStreams($relatedProductStreams[$number]);
            }
Home | Imprint | This part of the site doesn't use cookies.