AvailableCombinationResult example


    public function load(string $productId, Context $context, string $salesChannelId): AvailableCombinationResult
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'loadCombinations')
        );

        $combinations = $this->getCombinations($productId$context$salesChannelId);

        $result = new AvailableCombinationResult();

        foreach ($combinations as $combination) {
            try {
                $options = json_decode((string) $combination['options'], true, 512, \JSON_THROW_ON_ERROR);
            } catch (\JsonException) {
                continue;
            }

            $available = (bool) $combination['available'];
            $result->addCombination($options$available);
        }

        
Home | Imprint | This part of the site doesn't use cookies.