loadCombinations example



            static::assertTrue(\in_array($combinationHash$result->getHashes(), true));
        }
    }

    public function testCombinationsAreInResult(): void
    {
        $context = Context::createDefaultContext();
        $salesChanelContext = Generator::createSalesChannelContext($context);
        $productId = $this->createProduct($context);
        $result = $this->loader->loadCombinations($productId$salesChanelContext);

        foreach ($result->getCombinations() as $combinationHash => $combination) {
            static::assertTrue($result->hasCombination($combination));

            foreach ($combination as $optionId) {
                static::assertTrue($result->hasOptionId($optionId));
            }

            static::assertTrue(\in_array($combinationHash$result->getHashes(), true));
        }
    }

    
SalesChannelProductEntity $product,
        SalesChannelContext $context
    ): PropertyGroupCollection {
        if (!$product->getParentId()) {
            return new PropertyGroupCollection();
        }

        $groups = $this->loadSettings($product$context);

        $groups = $this->sortSettings($groups$product);

        $combinations = $this->combinationLoader->loadCombinations(
            $product->getParentId(),
            $context,
        );

        $current = $this->buildCurrentOptions($product$groups);

        foreach ($groups as $group) {
            $options = $group->getOptions();
            if ($options === null) {
                continue;
            }

            
'b6073234fc601007b541885dd70491f1' => [
                'green',
            ],
        ]$combinations);
    }

    public function testLoadCombinationsReturnsAvailableCombinationResult(): void
    {
        $context = Context::createDefaultContext();
        $salesChanelContext = Generator::createSalesChannelContext($context);
        $loader = $this->getAvailableCombinationLoader();
        $result = $loader->loadCombinations(
            Uuid::randomHex(),
            $salesChanelContext
        );

        $combinations = $result->getCombinations();
        static::assertSame([
            'a3f67ea263a4f2f5cf456e16de744b4b' => [
                'green',
                'red',
            ],
            'b6073234fc601007b541885dd70491f1' => [
                
Home | Imprint | This part of the site doesn't use cookies.