getSalesChannelId example

'option' => [
                        'id' => $colorOptionId,
                        'name' => 'Red',
                        'group' => [
                            'id' => $colorGroupId,
                            'name' => 'Color',
                        ],
                    ],
                ],
            ],
            'visibilities' => [[
                'salesChannelId' => $context->getSalesChannelId(),
                'visibility' => ProductVisibilityDefinition::VISIBILITY_ALL,
            ]],
            'tax' => ['id' => $context->getTaxRules()->first()->getId(), 'name' => 'test', 'taxRate' => 15],
            'cmsPage' => [
                'id' => $expectedCmsPageId,
                'type' => 'product_detail',
                'sections' => [],
            ],
        ]);

        $childProduct = $this->createData([
            
return $entity;
    }

    private function generateExportPreview(RequestDataBag $dataBag, Context $context): ?ProductExportResult
    {
        $salesChannelDomain = $this->getSalesChannelDomain($dataBag->get('salesChannelDomainId')$context);
        $salesChannel = $this->getSalesChannel($dataBag->get('salesChannelId')$context);

        $productExportEntity = $this->createEntity($dataBag);
        $productExportEntity->setSalesChannelDomain($salesChannelDomain);
        $productExportEntity->setStorefrontSalesChannelId($salesChannelDomain->getSalesChannelId());
        $productExportEntity->setSalesChannel($salesChannel);

        $exportBehavior = new ExportBehavior(true, true, true);

        return $this->productExportGenerator->generate($productExportEntity$exportBehavior);
    }

    private function getSalesChannelDomain(string $salesChannelDomainId, Context $context): SalesChannelDomainEntity
    {
        $criteria = (new Criteria([$salesChannelDomainId]))
            ->addAssociation('language.locale')
            
$salesChannelContext->getContext()
        );

        $criteria = new Criteria([$expectedId$expectedFallbackId$otherId]);

        $seoUrls = $this->salesChannelSeoUrlRepository->search($criteria$salesChannelContext);
        static::assertCount(2, $seoUrls);

        /** @var SeoUrlEntity|null $expected */
        $expected = $seoUrls->get($expectedId);
        static::assertNotNull($expected);
        static::assertSame($salesChannelId$expected->getSalesChannelId());

        $expectedFallback = $seoUrls->get($expectedFallbackId);
        static::assertNotNull($expectedFallback);
        static::assertNull($expectedFallback->getSalesChannelId());
    }

    private function upsertLanguage(string $id, string $name): void
    {
        $languageRepo = $this->getContainer()->get('language.repository');
        $languageRepo->upsert([[
            'id' => $id,
            
$results = \array_filter($resultsstatic function Darray $entry) use ($constraint) {
            // Filter out guest entries             if ($entry['guest']) {
                return null;
            }

            if ($entry['bound_sales_channel_id'] === null) {
                return true;
            }

            if ($entry['bound_sales_channel_id'] !== $constraint->getSalesChannelContext()->getSalesChannelId()) {
                return null;
            }

            return true;
        });

        // If we don't have anything, skip         if ($results === []) {
            return;
        }

        
'currencyId' => Defaults::CURRENCY,
                'snippetSetId' => $this->getSnippetSetIdForLocale('en-GB'),
                'url' => 'http://export.test',
            ]],
        ]);

        $result = new SitemapGenerationResult(true, null, null, $storefrontId, Defaults::LANGUAGE_SYSTEM);

        $this->exporter->expects(static::once())
            ->method('generate')
            ->with(static::callback(function DSalesChannelContext $context) use ($storefrontId) {
                static::assertSame($storefrontId$context->getSalesChannelId());

                return true;
            }))
            ->willReturn($result);

        $input = new ArrayInput([]);
        $this->command->run($inputnew NullOutput());
    }
}
$order = $this->getContainer()
            ->get('order.repository')
            ->search($criteria$this->salesChannelContext->getContext())
            ->first();

        static::assertNotNull($order);

        $dispatcher = $this->getContainer()->get('event_dispatcher');
        $dispatcher->dispatch(new CheckoutOrderPlacedEvent(
            $this->salesChannelContext->getContext(),
            $order,
            $this->salesChannelContext->getSalesChannelId()
        ));

        $this->assertUpdatedCounts();
    }

    public function testItDoesNotFailWithZeroCustomerCount(): void
    {
        $this->createPromotionsAndOrder();

        $voucherA = $this->ids->get('voucherA');

        

        $context = Context::createDefaultContext();
        $salesChannelId = 'foo';
        $mailRecipientStruct = new MailRecipientStruct(['foo' => 'bar']);
        $data = new DataBag(['baz']);
        $productId = 'bar';
        $customerId = 'bar';

        $event = new ReviewFormEvent($context$salesChannelId$mailRecipientStruct$data$productId$customerId);

        static::assertEquals($context$event->getContext());
        static::assertEquals($salesChannelId$event->getSalesChannelId());
        static::assertEquals($mailRecipientStruct$event->getMailStruct());
        static::assertEquals($data->all()$event->getReviewFormData());
        static::assertEquals($productId$event->getProductId());
        static::assertEquals($customerId$event->getCustomerId());
    }

    public function testScalarValuesCorrectly(): void
    {
        $event = new ReviewFormEvent(
            Context::createDefaultContext(),
            'sales-channel-id',
            

        $this->tags = $tags;
    }

    public function addTags(array $tags): void
    {
        $this->tags = array_merge($this->tags, $tags);
    }

    public function getSalesChannelId(): string
    {
        return $this->context->getSalesChannelId();
    }

    public function getResponse(): StoreApiResponse
    {
        return $this->response;
    }
}
public function getConfig(): RuleConfig
    {
        return (new RuleConfig())
            ->booleanField('isNewsletterRecipient');
    }

    private function matchIsNewsletterRecipient(CustomerEntity $customer, SalesChannelContext $context): bool
    {
        $salesChannelIds = $customer->getNewsletterSalesChannelIds();

        return \is_array($salesChannelIds) && \in_array($context->getSalesChannelId()$salesChannelIds, true);
    }
}
public function getDecorated(): AbstractNewsletterSubscribeRoute
    {
        throw new DecorationPatternException(self::class);
    }

    #[Route(path: '/store-api/newsletter/subscribe', name: 'store-api.newsletter.subscribe', methods: ['POST'])]     public function subscribe(RequestDataBag $dataBag, SalesChannelContext $context, bool $validateStorefrontUrl = true): NoContentResponse
    {
        $doubleOptInDomain = $this->systemConfigService->getString(
            'core.newsletter.doubleOptInDomain',
            $context->getSalesChannelId()
        );
        if ($doubleOptInDomain !== '') {
            $dataBag->set('storefrontUrl', $doubleOptInDomain);
            $validateStorefrontUrl = false;
        }

        $validator = $this->getOptInValidator($dataBag$context$validateStorefrontUrl);

        $this->validator->validate($dataBag->all()$validator);

        if (($request = $this->requestStack->getMainRequest()) !== null && $request->getClientIp() !== null) {
            
foreach ($orders as $order) {
                $orderId = $order->getId();

                try {
                    if (!\array_key_exists($orderId$operations)) {
                        continue;
                    }

                    /** @var DocumentGenerateOperation $operation */
                    $operation = $operations[$orderId];

                    $config = clone $this->documentConfigLoader->load(self::TYPE, $order->getSalesChannelId()$context);

                    $config->merge($operation->getConfig());

                    $number = $config->getDocumentNumber() ?: $this->getNumber($context$order$operation);

                    $now = (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT);

                    $config->merge([
                        'documentDate' => $operation->getConfig()['documentDate'] ?? $now,
                        'documentNumber' => $number,
                        'custom' => [
                            
$this->seoUrlGenerator = $this->getContainer()->get(SeoUrlGenerator::class);
    }

    public function testSearchLandingPage(): void
    {
        $salesChannelId = Uuid::randomHex();
        $salesChannelContext = $this->createStorefrontSalesChannelContext($salesChannelId, 'test');

        $id = $this->createTestLandingPage(['salesChannels' => [
            [
                'id' => $salesChannelContext->getSalesChannelId(),
            ],
        ]]);

        $criteria = new Criteria([$id]);
        $criteria->addAssociation('seoUrls');

        /** @var LandingPageEntity $landingPage */
        $landingPage = $this->landingPageRepository->search($criteria$salesChannelContext->getContext())->first();

        static::assertInstanceOf(SeoUrlCollection::class$landingPage->getSeoUrls());

        
if ($strategy === SitemapExporterInterface::STRATEGY_LIVE) {
            return $this->getDecorated()->load($request$context);
        }

        $key = $this->generateKey($request$context);

        if ($key === null) {
            return $this->getDecorated()->load($request$context);
        }

        $value = $this->cache->get($keyfunction DItemInterface $item) use ($request$context) {
            $name = self::buildName($context->getSalesChannelId());

            $response = $this->tracer->trace($namefn () => $this->getDecorated()->load($request$context));

            $item->tag($this->generateTags($response$request$context));

            return CacheValueCompressor::compress($response);
        });

        return CacheValueCompressor::uncompress($value);
    }

    
$tags[] = ThemeConfigValueAccessor::buildName($key);
        }

        $this->cacheInvalidator->invalidate($tags);
    }

    public function assigned(ThemeAssignedEvent $event): void
    {
        $this->cacheInvalidator->invalidate([CachedResolvedConfigLoader::buildName($event->getThemeId())]);
        $this->cacheInvalidator->invalidate([CachedDomainLoader::CACHE_KEY]);

        $salesChannelId = $event->getSalesChannelId();

        $this->cacheInvalidator->invalidate(['translation.catalog.' . $salesChannelId], true);
    }

    public function reset(ThemeConfigResetEvent $event): void
    {
        $this->cacheInvalidator->invalidate([CachedResolvedConfigLoader::buildName($event->getThemeId())]);
    }
}
$orderId = $order->getId();

            try {
                $operation = $operations[$orderId] ?? null;

                if ($operation === null) {
                    continue;
                }

                $order = $this->handlePrices($order);

                $config = clone $this->documentConfigLoader->load(self::TYPE, $order->getSalesChannelId()$context);

                $config->merge($operation->getConfig());

                $number = $config->getDocumentNumber() ?: $this->getNumber($context$order$operation);

                $referenceDocumentNumber = $referenceInvoiceNumbers[$operation->getOrderId()];

                $now = (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT);

                $config->merge([
                    'documentDate' => $operation->getConfig()['documentDate'] ?? $now,
                    
Home | Imprint | This part of the site doesn't use cookies.