createFromListProduct example

$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]);
            }

            if (isset($similarProducts[$number])) {
                $product->setSimilarProducts($similarProducts[$number]);
            }
$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);

        $result = [];
        foreach ($products as $listProduct) {
            $product = Product::createFromListProduct($listProduct);
            $number = $product->getNumber();
            $id = $product->getId();

            $product->setHasStock($product->getStock() >= $product->getUnit()->getMinPurchase());

            if ($variantFacet && $variantConfiguration) {
                $this->addVariantSearchDetails($product$configurations$variantFacet$variantConfiguration$combinations$listingPrices$availability);
            } elseif (!$product->isMainVariant()) {
                continue;
            } elseif (!$listProduct->isAvailable()) {
                $product->setHasAvailableVariant(false);
            }
Home | Imprint | This part of the site doesn't use cookies.