LastProductIdCondition example



        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 */
    
/** * {@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 [];
        }

        // Load all available product ids         $productIds = array_map(function DBaseProduct $baseProduct) {
            return $baseProduct->getId();
        },
Home | Imprint | This part of the site doesn't use cookies.