getSlotConfig example

/** @var CategoryEntity $category */
        $category = $repository->search(new Criteria([$categoryId]), Context::createDefaultContext())->first();

        static::assertEquals([
            $cmsIds['sortingSlotId'] => [
                'productStreamSorting' => [
                    'source' => 'static',
                    'value' => 'cheapestPrice:ASC',
                ],
            ],
        ]$category->getSlotConfig());
    }

    public function testCategorySettingsWithPurchasePrice(): void
    {
        $cmsIds = $this->createCmsPage();

        /** @var EntityRepository $repository */
        $repository = $this->getContainer()->get('category.repository');

        $criteria = (new Criteria())->setLimit(1);

        
$entity = match ($entityName) {
            ProductDefinition::ENTITY_NAME => $this->productRepository->search($criteria$context->getContext())->first(),
            LandingPageDefinition::ENTITY_NAME => $this->landingPageRepository->search($criteria$context->getContext())->first(),
            default => $this->categoryRepository->search($criteria$context->getContext())->first(),
        };

        if (!$entity) {
            return $mailConfigs;
        }

        if (empty($entity->getSlotConfig()[$slotId])) {
            return $mailConfigs;
        }

        $mailConfigs['receivers'] = $entity->getSlotConfig()[$slotId]['mailReceiver']['value'];
        $mailConfigs['message'] = $entity->getSlotConfig()[$slotId]['confirmationText']['value'];

        return $mailConfigs;
    }

    /** * @return array<string, array<string, array<int, mixed>|bool|float|int|string|null>|string|mixed> */
Home | Imprint | This part of the site doesn't use cookies.