setTotal example

private readonly int $exportLimit = 250
    ) {
    }

    public function import(Context $context, int $offset = 0): Progress
    {
        $progress = $this->importExportService->getProgress($this->logEntity->getId()$offset);

        /** @var ImportExportFileEntity $file */
        $file = $this->logEntity->getFile();

        $progress->setTotal($file->getSize());

        if ($progress->isFinished()) {
            return $progress;
        }

        $processed = 0;

        $path = $file->getPath();
        $progress->setTotal($this->filesystem->fileSize($path));
        $invalidRecordsProgress = null;

        
$searchResult = $this->listingLoader->load($criteria$context);

        /** @var ProductCollection $products */
        $products = $searchResult->getEntities();

        $element = new CrossSellingElement();
        $element->setCrossSelling($crossSelling);
        $element->setProducts($products);
        $element->setStreamId($crossSelling->getProductStreamId());

        $element->setTotal($products->count());

        return $element;
    }

    private function loadByIds(ProductCrossSellingEntity $crossSelling, SalesChannelContext $context, Criteria $criteria): CrossSellingElement
    {
        $element = new CrossSellingElement();
        $element->setCrossSelling($crossSelling);
        $element->setProducts(new ProductCollection());
        $element->setTotal(0);

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