createCategoryStreamCriteria example

'showListingButton' => $this->hasProducts($categoryId$context$streamId),
        ];
    }

    private function hasProducts(int $categoryId, ShopContextInterface $context, ?int $streamId): bool
    {
        if ($this->Request()->getParam('sPage')) {
            return false;
        }

        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();
        
Home | Imprint | This part of the site doesn't use cookies.