resetConditions example

private function createFacets(SearchBundle\Criteria $criteria, ShopContextInterface $context)
    {
        if (\count($criteria->getFacets()) === 0) {
            return [];
        }

        $facets = [];

        $clone = clone $criteria;

        if (!$criteria->generatePartialFacets()) {
            $clone->resetConditions();
            $clone->resetSorting();
        }

        foreach ($criteria->getFacets() as $facet) {
            $handler = $this->getFacetHandler($facet);

            if ($criteria->generatePartialFacets() && !$handler instanceof PartialFacetHandlerInterface) {
                throw new RuntimeException(sprintf("New filter mode activated, handler class %s doesn't support this mode", \get_class($handler)));
            }

            if ($handler instanceof PartialFacetHandlerInterface) {
                
return $this->Front()->ensureRouter()->assemble(['controller' => 'index']);
        }

        $checkRedirect = ($hasEmotion && $this->Request()->getParam('sPage')) || (!$hasEmotion);

        if (!$checkRedirect || !$this->config->get('categoryDetailLink')) {
            return null;
        }

        $criteria = $this->storeFrontCriteriaFactory->createListingCriteria($this->Request()$context);
        $criteria->resetFacets()
            ->resetConditions()
            ->resetSorting()
            ->offset(0)
            ->limit(2)
            ->setFetchCount(false);
        $result = $this->productNumberSearch->search($criteria$context);
        if (\count($result->getProducts()) !== 1) {
            return null;
        }

        $products = $result->getProducts();
        $firstProducts = array_shift($products);

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