getProductStream example

$media = null;
        if ($category->getMedia()) {
            $media = $this->convertMediaStruct($category->getMedia());
        }

        $attribute = [];
        if ($category->hasAttribute('core')) {
            $attribute = $category->getAttribute('core')->toArray();
        }

        $productStream = null;
        if ($category->getProductStream()) {
            $productStream = $this->convertRelatedProductStreamStruct($category->getProductStream());
        }

        $categoryPath = '|' . implode('|', $category->getPath()) . '|';

        $blogBaseUrl = $this->config->get('baseFile') . '?sViewport=blog&sCategory=';
        $baseUrl = $this->config->get('baseFile') . '?sViewport=cat&sCategory=';
        $detailUrl = ($category->isBlog() ? $blogBaseUrl : $baseUrl) . $category->getId();
        $canonicalParams = $this->getCategoryCanonicalParams($category);

        if ($media && !\array_key_exists('path', $media)) {
            
'salesChannelId' => $this->getSalesChannelId(),
                'salesChannelDomainId' => $this->getSalesChannelDomainId(),
                'generateByCronjob' => false,
                'currencyId' => Defaults::CURRENCY,
            ],
        ]$this->context);

        $criteria = new Criteria([$id]);
        $criteria->addAssociation('productStream');
        $entity = $this->repository->search($criteria$this->context)->get($id);

        static::assertNotNull($entity->getProductStream());
    }

    public function testFetchSalesChannel(): void
    {
        $id = Uuid::randomHex();
        $this->repository->upsert([
            [
                'id' => $id,
                'fileName' => 'Testexport',
                'accessKey' => Uuid::randomHex(),
                'encoding' => ProductExportEntity::ENCODING_UTF8,
                
$pages = (int) $this->Request()->getParam('pages', 1);
        $offset = (int) $this->Request()->getParam('start', $limit * ($pages - 1));

        $maxPages = 0;
        $max = (int) $this->Request()->getParam('max');
        if ($limit !== 0) {
            $maxPages = round($max / $limit);
        } else {
            $limit = 0;
        }

        $values = $this->getProductStream($streamId$offset$limit);

        $this->View()->assign('articles', $values['values']);
        $this->View()->assign('productBoxLayout', $this->Request()->getParam('productBoxLayout', 'emotion'));
        $this->View()->assign('fixedImageSize', $this->Request()->getParam('fixedImageSize', true));
        $this->View()->assign('pages', $values['pages'] > $maxPages ? $maxPages : $values['pages']);
        $this->View()->assign('sPerPage', $limit);
    }

    /** * Returns a list of top sold products * * @param int $category * @param int $offset * @param int $limit * @param string $sort * * @return array */
$this->setSearchResultResponse($result);

            return;
        }

        $categoryId = (int) $this->Request()->getParam('sCategory');

        $context = $this->container->get(ContextServiceInterface::class)->getShopContext();

        $category = $this->container->get(CategoryGateway::class)->get($categoryId$context);
        if ($category instanceof Category) {
            $productStream = $category->getProductStream();

            if ($productStream) {
                $result = $this->fetchStreamListing($categoryId$productStream->getId());
                $this->setSearchResultResponse($result);

                return;
            }
        }

        $result = $this->fetchCategoryListing();
        $this->setSearchResultResponse($result);
    }
Home | Imprint | This part of the site doesn't use cookies.