getListingConfiguration example

public function testChangeProductConfigToVariantGroups(): void
    {
        // main variant will be set initially         $this->createProduct([], true);

        // update product with no main variant         $this->productRepository->update([[
            'id' => $this->productId,
            'variantListingConfig' => [
                'mainVariantId' => null,
                'configuratorGroupConfig' => $this->getListingConfiguration(['color', 'size']),
            ],
        ]]$this->salesChannelContext->getContext());

        $listing = $this->fetchListing();

        // all variants should be returned         static::assertEquals(4, $listing->getTotal());

        $variants = $listing->getIds();

        static::assertContains($this->variantIds['redXl']$variants);
        

        $ids = array_filter($ids);

        if (empty($ids)) {
            return;
        }

        $ids = array_keys(array_flip($ids));

        $versionBytes = Uuid::fromHexToBytes($context->getVersionId());

        $listingConfiguration = $this->getListingConfiguration($ids$context);

        $displayParent = new RetryableQuery(
            $this->connection,
            $this->connection->prepare('UPDATE product SET display_group = MD5(HEX(product.id)) WHERE product.id = :id AND product.version_id = :versionId')
        );

        $hideParent = new RetryableQuery(
            $this->connection,
            $this->connection->prepare('UPDATE product SET display_group = NULL WHERE product.id = :id AND product.version_id = :versionId')
        );

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