removeBaseCondition example

if (!$criteria->hasBaseCondition('category')) {
            $criteria->addBaseCondition(new CategoryCondition([$systemId]));

            return $criteria;
        }

        /** @var CategoryCondition $condition */
        $condition = $criteria->getBaseCondition('category');

        if (!\in_array($systemId$condition->getCategoryIds())) {
            $criteria->removeBaseCondition('category');
            $criteria->addCondition($condition);
            $criteria->addBaseCondition(new CategoryCondition([$systemId]));
        }

        return $criteria;
    }

    /** * @return Criteria */
    private function createCriteriaFromRequest(Request $request, ShopContextInterface $context)
    {

        $this->criteriaFactory = $criteriaFactory;
    }

    /** * @return Criteria */
    public function createCriteria(Request $request, ShopContextInterface $context)
    {
        $criteria = $this->criteriaFactory->createListingCriteria($request$context);

        $criteria->removeBaseCondition('category');
        $criteria->resetFacets();

        $category = $context->getShop()->getCategory()->getId();
        $criteria->addBaseCondition(new CategoryCondition([$category]));

        return $criteria;
    }
}
return $result;
        }

        foreach ($products as $product) {
            $result[] = $product->getId();
        }

        sort($result, SORT_NUMERIC);

        $lastProductId = $result[\count($result) - 1];

        $criteria->removeBaseCondition('last_product_id');
        $criteria->addBaseCondition(new LastProductIdCondition($lastProductId));

        return array_merge($result$this->readProductUrlsRecursive($criteria));
    }

    /** * Reads the blog item urls * * @param int $parentId * * @return array */
Home | Imprint | This part of the site doesn't use cookies.