setFetchCount example

if ($streamId) {
            $criteria = $this->createCategoryStreamCriteria($categoryId$streamId$context);
        } else {
            $criteria = $this->storeFrontCriteriaFactory
                ->createListingCriteria($this->Request()$context);
        }

        // Creating the criteria above will also set the sPage param to at least 1, which we don't want         $this->Request()->setParam('sPage', null);

        // Performance increase         $criteria->setFetchCount(false);
        $criteria->resetFacets();
        $criteria->limit(1);

        $numberResult = $this->productNumberSearch->search($criteria$context);

        return $numberResult->getTotalCount() > 0;
    }

    /** * @param array<string, mixed> $categoryContent */
    
 else {
            $category = $this->categoryId;
        }

        $context = $this->contextService->getShopContext();

        $criteria = $this->storeFrontCriteriaFactory->createBaseCriteria([$category]$context);
        $criteria->limit($sLimitChart);

        $criteria->addSorting(new PopularitySorting(SortingInterface::SORT_DESC));

        $criteria->setFetchCount(false);

        $result = $this->searchService->search($criteria$context);
        $products = $this->legacyStructConverter->convertListProductStructList($result->getProducts());

        Shopware()->Events()->notify(
            'Shopware_Modules_Articles_GetArticleCharts',
            ['subject' => $this, 'category' => $category, 'articles' => $products]
        );

        return $products;
    }

    


        $fallbackResult = [];
        foreach ($fallback as $product) {
            $criteria = $this->factory->createBaseCriteria([$context->getShop()->getCategory()->getId()]$context);
            $criteria->limit($limit);

            $condition = new SimilarProductCondition($product->getId()$product->getName());

            $criteria->addBaseCondition($condition);
            $criteria->addSorting(new PopularitySorting());
            $criteria->setFetchCount(false);

            $searchResult = $this->search->search($criteria$context);

            $fallbackResult[$product->getNumber()] = $searchResult->getProducts();
        }

        return $result + $fallbackResult;
    }

    /** * @param array<string, ListProduct> $similarProducts * @param array<string> $similarProductNumbersByProductId * * @return array<string, ListProduct> */
if ($result) {
            $stream->setStatic($result['static']);
            $stream->setFreezeUp($result['freezeUp']);
        }

        if ($stream->getFreezeUp() !== null || $stream->isStatic()) {
            return;
        }

        $criteria = $this->criteriaFactory->createCriteria($stream->getId());

        $criteria->setFetchCount(false);
        $criteria->offset((int) $offset);

        if ($limit !== null) {
            $criteria->limit((int) $limit);
        }

        if ($criteria->getOffset() === 0) {
            $this->streamIndexer->clearStreamIndex($stream->getId());
        }

        $this->streamIndexer->populatePartial($stream->getId()$criteria);
    }
$this->connection = $connection;
        $this->batchSize = $batchSize;
    }

    /** * {@inheritdoc} */
    public function getUrls(Context $routingContext, ShopContextInterface $shopContext)
    {
        $criteria = $this->storeFrontCriteriaFactory
            ->createBaseCriteria([$shopContext->getShop()->getCategory()->getId()]$shopContext);
        $criteria->setFetchCount(false);
        $criteria->limit($this->batchSize);

        if ($this->lastId) {
            $criteria->addBaseCondition(new LastProductIdCondition($this->lastId));
        }

        $productNumberSearchResult = $this->productNumberSearch->search($criteria$shopContext);

        if (\count($productNumberSearchResult->getProducts()) === 0) {
            return [];
        }

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