convertListProductStructList example

break;
            case 'topseller':
                $criteria->addSorting(new PopularitySorting(SortingInterface::SORT_DESC));
                break;
            case 'newcomer':
                $criteria->addSorting(new ReleaseDateSorting(SortingInterface::SORT_DESC));
                break;
        }

        /** @var ProductSearchResult $result */
        $result = Shopware()->Container()->get(ProductSearchInterface::class)->search($criteria$context);
        $data = Shopware()->Container()->get(LegacyStructConverter::class)->convertListProductStructList($result->getProducts());

        $count = $result->getTotalCount();
        if ($limit !== 0) {
            $pages = round($count / $limit);
        } else {
            $pages = 0;
        }

        if ($pages === 0 && $count > 0) {
            $pages = 1;
        }

        
$this->View()->loadTemplate('frontend/listing/listing_ajax.tpl');
        }

        if (!\is_array($numbers)) {
            return;
        }

        $context = $this->container->get(ContextServiceInterface::class)->getShopContext();

        $products = $this->container->get(ListProductServiceInterface::class)->getList($numbers$context);

        $convertedProducts = $this->container->get(LegacyStructConverter::class)->convertListProductStructList($products);

        $this->View()->assign(['sArticles' => $convertedProducts, 'articles' => $convertedProducts]);
    }

    /** * @return void */
    public function streamAction()
    {
        $streamId = (int) $this->Request()->getParam('streamId');

        
if (!\count($orderDetails)) {
            unset($orders[$orderKey]);

            return $orders;
        }

        $context = $this->contextService->getShopContext();
        $orderProductOrderNumbers = array_column($orderDetails, 'articleordernumber');
        $listProducts = Shopware()->Container()->get(ListProductServiceInterface::class)
            ->getList($orderProductOrderNumbers$context);
        $listProducts = Shopware()->Container()->get(LegacyStructConverter::class)
            ->convertListProductStructList($listProducts);

        foreach ($listProducts as &$listProduct) {
            $listProduct = array_merge($listProduct$listProduct['prices'][0]);
        }

        foreach ($orderDetails as $orderDetailsKey => $orderDetailsValue) {
            $orderDetails[$orderDetailsKey]['amountNumeric'] = round($orderDetailsValue['price'] * $orderDetailsValue['quantity'], 2);
            $orderDetails[$orderDetailsKey]['priceNumeric'] = $orderDetailsValue['price'];
            $orderDetails[$orderDetailsKey]['amount'] = $this->moduleManager->Articles()
                ->sFormatPrice($orderDetails[$orderDetailsKey]['amountNumeric']);
            $orderDetails[$orderDetailsKey]['price'] = $this->moduleManager->Articles()
                
break;

            case ArticleSliderComponentHandler::COMPONENT_NAME:
                if (
                    !$element->getData()->get('products')
                    || empty(array_filter($element->getData()->get('products')))) {
                    break;
                }

                $elementArray['data']['categoryId'] = (int) $elementArray['article_slider_category'];

                $products = $this->converter->convertListProductStructList($element->getData()->get('products'));

                $type = $element->getConfig()->get('article_slider_type', ArticleSliderComponentHandler::TYPE_STATIC_PRODUCT);
                if ($type === ArticleSliderComponentHandler::TYPE_STATIC_VARIANT) {
                    $products = array_map(function D$product) {
                        $product['linkDetails'] = $product['linkVariant'];

                        return $product;
                    }$products);
                }

                $elementArray['data']['values'] = array_values($products);
                

    private function getPromotions($numbers)
    {
        if (empty($numbers)) {
            return [];
        }

        $context = $this->get(ContextServiceInterface::class)->getShopContext();
        $products = $this->get(ListProductServiceInterface::class)
            ->getList($numbers$context);

        return $this->get(LegacyStructConverter::class)->convertListProductStructList($products);
    }
}
$context = $this->contextService->getShopContext();

        $criteria = $this->storeFrontCriteriaFactory->createBaseCriteria([$category]$context);
        $criteria->limit($sLimitChart);

        $criteria->addSorting(new PopularitySorting(SortingInterface::SORT_DESC));

        $criteria->setFetchCount(false);

        $result = $this->searchService->search($criteria$context);
        $products = $this->legacyStructConverter->convertListProductStructList($result->getProducts());

        Shopware()->Events()->notify(
            'Shopware_Modules_Articles_GetArticleCharts',
            ['subject' => $this, 'category' => $category, 'articles' => $products]
        );

        return $products;
    }

    /** * Check if a product has an instant download * * @deprecated in 5.5, this function will be removed in 5.7 without replacement * * @param int $id s_articles.id * @param int $detailsID s_articles_details.id * @param bool $realtime * * @return bool */
Home | Imprint | This part of the site doesn't use cookies.