productListUtil->getProductList(); $productsList->andSpec($this->blockUtil->getProductsBlockSpecs($blocekData)); $productsList->andSpec(function (QueryBuilder $qb) use ($blocekData) { if ($blocekData['orderBy'] ?? false) { $qb->orderBySql($blocekData['orderBy']); } if ($blocekData['count'] ?? false) { $qb->setMaxResults($blocekData['count']); } }); if (findModule(\Modules::RESTRICTIONS)) { $productsList->andSpec($this->restrictions->getRestrictionSpec()); } $productsCollection = $productsList->getProducts(); $productsCollection->fetchProductsPhotoIds(); $retailType = Contexts::get(UserContext::class)->getRetailPriceType(); $retailType->prefetchProductCollection($productsCollection); $originalType = Contexts::get(UserContext::class)->getOriginalPriceType(); $originalType->prefetchProductCollection($productsCollection); $this->productDataProvider->addProducts($productsCollection); return $renderer->renderToString('BlocekProducts', [ 'productList' => $productsCollection, 'itemType' => 'square', ]); } #[Query] #[Module(\Modules::COMPONENTS)] public function componentBlock(ResolveInfo $resolveInfo, #[Autowire] ComponentRenderer $renderer, #[UseInputType('String')] $data): string { if (!$data) { throw new NotFoundHttpException('Empty data'); } $blocekData = json_decode_strict(html_entity_decode($data), true); try { return $renderer->renderToString($blocekData['name'], $blocekData['params'] ?? []); } catch (\Exception $e) { if (isDevelopment()) { return $e->getMessage(); } return ''; } } }