34: return $entity;
35: }
36:
37: public function getAllBy(
41: ElasticQuery $elasticQuery,
42: ): \Spameri\Elastic\Entity\IElasticEntityCollection {
43: try {
44: $resultSearch = $this->getAllBy->execute($elasticQuery, $this->index);
45: } catch (\Spameri\Elastic\Exception\ElasticSearch $exception) {
46: \Tracy\Debugger::log($exception->getMessage(), \Tracy\ILogger::CRITICAL);
47:
48: throw $exception;
| $options |
|
| $index | 'ksfitness_product'
|
56: new Min(
57: 'minPrice',
58: 'pricesFinalVAT_' . $locale . '.' . $this->user->getRoles()[0],
59: )
60: )
61: );
62:
63: $query->options()->changeSize(1);
64:
65: try {
66: $attributeAggregations = $this->productService->getAllBy($query);
67: } catch (\Spameri\Elastic\Exception\DocumentNotFound $e) {
68: return [];
69: }
70:
150: return $this->frontPriceFactory->create();
151: }
152:
153: public function getValuesCount(int $exceptId): array
154: {
155: return $this->productFilterFacade->getValuesCount(clone $this->filters, $exceptId);
156: }
157:
158: public function getPriceValuesCount(): array
159: {
160: return $this->productPriceFilterFacade->getPriceValuesCount(clone $this->filters, $this->presenter->locale);
161: }
162:
163: public function getStockValuesCount(): array
164: {
78:
79: public function blockPrices(array $ʟ_args): void
81: {
82: extract($this->params);
83: extract($ʟ_args);
84: unset($ʟ_args);
85: $this->global->snippetDriver->enter("prices", 'static');
86: try {
87: echo ' ';
88: $minMax = $control->getPriceValuesCount() /* line 15 */;
89: echo "\n";
90: if ($minMax) {
91: echo "\n";
92: $minValue = $control->getPresenter()->min ?: $minMax['minPrice'] ;
5: {form priceForm}
6: <div class="category-filter__item jsCategoryFilterItem xsDesktop-none">
7: <div class="category-filter__header jsAccordionHeader"
8: data-parent="category-filter">
9: <span class="category-filter__tag">Cenové rozpětí</span>
10: <span class="c-1 link link--arrow link--arrow-up">Zobrazit</span>
11: <span class="c-1 link link--arrow link--arrow-down">{_front.utilities.hide}</span>
12: </div>
13: <div class="category-filter__body">
14: <div class="row" n:snippet="prices">
15: {var $minMax = $control->getPriceValuesCount()}
16: {if $minMax}
17:
18: {var $minValue = $control->getPresenter()->min ?: $minMax['minPrice']}
19: {var $maxValue = $control->getPresenter()->max ?: $minMax['maxPrice']}
299:
300: if (!$block) {
301: $hint = ($t = Latte\Helpers::getSuggestion($this->getBlockNames($layer), $name))
302: ? ", did you mean '$t'?"
303: : '.';
304: $name = $layer ? "$layer $name" : $name;
305: throw new Latte\RuntimeException("Cannot include undefined block '$name'$hint");
306: }
307:
308: $this->filter(
309: function () use ($block, $params): void { reset($block->functions)($params); },
310: $mod,
311: $block->contentType,
312: "block $name"
313: );
354: $block->functions = array_merge($block->functions, $functions);
355: }
356:
357:
358: private function filter(callable $function, $mod, string $contentType, string $name): void
362: {
363: if ($mod === null || $mod === $contentType) {
364: $function();
365:
366: } elseif ($mod instanceof \Closure) {
367: echo $mod($this->capture($function), $contentType);
368:
298: : ($this->blocks[self::LAYER_LOCAL][$name] ?? $this->blocks[self::LAYER_TOP][$name] ?? null);
299:
300: if (!$block) {
301: $hint = ($t = Latte\Helpers::getSuggestion($this->getBlockNames($layer), $name))
302: ? ", did you mean '$t'?"
303: : '.';
304: $name = $layer ? "$layer $name" : $name;
305: throw new Latte\RuntimeException("Cannot include undefined block '$name'$hint");
306: }
307:
308: $this->filter(
309: function () use ($block, $params): void { reset($block->functions)($params); },
310: $mod,
311: $block->contentType,
312: "block $name"
| $function |
|
| $mod | null
|
| $contentType | 'html'
|
| $name | 'block prices'
|
55: }
56:
57: echo LR\Filters::escapeHtmlText(call_user_func($this->filters->translate, $ʟ_contributteTranslationMessage));
58: echo '</span>
59: </div>
60: <div class="category-filter__body">
61: <div class="row"';
62: echo ' id="' . htmlspecialchars($this->global->snippetDriver->getHtmlId('prices')) . '"';
63: echo '>
64: ';
65: $this->renderBlock('prices', [], null, 'snippet');
66: echo ' </div>
67: </div>
68: </div>
69: ';
1: {varType App\ElasticModule\Data\ProductSearchFilters $filters}
2: {varType App\FrontModule\Components\ProductFilterControl $control}
3:
4: {snippetArea form}
5: {form priceForm}
6: <div class="category-filter__item jsCategoryFilterItem xsDesktop-none">
7: <div class="category-filter__header jsAccordionHeader"
8: data-parent="category-filter">
9: <span class="category-filter__tag">Cenové rozpětí</span>
10: <span class="c-1 link link--arrow link--arrow-up">Zobrazit</span>
11: <span class="c-1 link link--arrow link--arrow-down">{_front.utilities.hide}</span>
12: </div>
13: <div class="category-filter__body">
14: <div class="row" n:snippet="prices">
15: {var $minMax = $control->getPriceValuesCount()}
| $name | 'prices'
|
| $params | array (0)
|
| $mod | null
|
| $layer | 'snippet'
|
299:
300: if (!$block) {
301: $hint = ($t = Latte\Helpers::getSuggestion($this->getBlockNames($layer), $name))
302: ? ", did you mean '$t'?"
303: : '.';
304: $name = $layer ? "$layer $name" : $name;
305: throw new Latte\RuntimeException("Cannot include undefined block '$name'$hint");
306: }
307:
308: $this->filter(
309: function () use ($block, $params): void { reset($block->functions)($params); },
310: $mod,
311: $block->contentType,
312: "block $name"
313: );
354: $block->functions = array_merge($block->functions, $functions);
355: }
356:
357:
358: private function filter(callable $function, $mod, string $contentType, string $name): void
362: {
363: if ($mod === null || $mod === $contentType) {
364: $function();
365:
366: } elseif ($mod instanceof \Closure) {
367: echo $mod($this->capture($function), $contentType);
368:
298: : ($this->blocks[self::LAYER_LOCAL][$name] ?? $this->blocks[self::LAYER_TOP][$name] ?? null);
299:
300: if (!$block) {
301: $hint = ($t = Latte\Helpers::getSuggestion($this->getBlockNames($layer), $name))
302: ? ", did you mean '$t'?"
303: : '.';
304: $name = $layer ? "$layer $name" : $name;
305: throw new Latte\RuntimeException("Cannot include undefined block '$name'$hint");
306: }
307:
308: $this->filter(
309: function () use ($block, $params): void { reset($block->functions)($params); },
310: $mod,
311: $block->contentType,
312: "block $name"
| $function |
|
| $mod | null
|
| $contentType | 'html'
|
| $name | 'block form'
|
7: {
8: protected const BLOCKS = [
9: 'snippet' => ['form' => 'blockForm', 'prices' => 'blockPrices'],
10: ];
11:
12:
13: public function main(): array
14: {
15: extract($this->params);
16: echo "\n";
17: $this->renderBlock('form', [], null, 'snippet') /* line 4 */;
18: echo "\n";
19: return get_defined_vars();
20: }
21:
1: {varType App\ElasticModule\Data\ProductSearchFilters $filters}
2: {varType App\FrontModule\Components\ProductFilterControl $control}
3:
4: {snippetArea form}
5: {form priceForm}
6: <div class="category-filter__item jsCategoryFilterItem xsDesktop-none">
7: <div class="category-filter__header jsAccordionHeader"
8: data-parent="category-filter">
9: <span class="category-filter__tag">Cenové rozpětí</span>
10: <span class="c-1 link link--arrow link--arrow-up">Zobrazit</span>
11: <span class="c-1 link link--arrow link--arrow-down">{_front.utilities.hide}</span>
12: </div>
13: <div class="category-filter__body">
14: <div class="row" n:snippet="prices">
15: {var $minMax = $control->getPriceValuesCount()}
| $name | 'form'
|
| $params | array (0)
|
| $mod | null
|
| $layer | 'snippet'
|
161: public function render(?string $block = null): void
166: {
167: $level = ob_get_level();
168: try {
169: $this->prepare();
170: if (!$this->doRender($block)) {
171: $this->main();
172: }
173:
174: } catch (\Throwable $e) {
175: while (ob_get_level() > $level) {
92:
93: public function render(string $name, $params = [], ?string $block = null): void
98: {
99: $template = $this->createTemplate($name, $this->processParams($params));
100: $template->global->coreCaptured = false;
101: ($this->probe)($template);
102: $template->render($block);
103: }
104:
105:
106:
36: return $this->latte;
37: }
38:
39:
40: public function render(?string $file = null, array $params = []): void
44: {
45: Nette\Utils\Arrays::toObject($params, $this);
46: $this->latte->render($file ?: $this->file, $this);
47: }
48:
49:
50:
| $name | '/srv/app/modules/FrontModule/components/../templates/components/ProductFilter/priceMobile.latte'
|
| $params |
|
11: class PriceFilterMobileControl extends FilterControl
12: {
13: public const TEMPLATE = __DIR__ . '/../templates/components/ProductFilter/priceMobile.latte';
14:
15: public function render(): void
16: {
17: $this->template->setFile(self::TEMPLATE);
18:
19: $this->template->filters = $this->filters;
20:
21: $this->template->render();
22: }
23:
24: protected function createComponentPriceForm(): Form
25: {
221: if (is_string($ʟ_contributteTranslationMessage)) {
222: $ʟ_contributteTranslationMessage = isset($ʟ_contributteTranslationPrefix) && !\Contributte\Translation\Helpers::isAbsoluteMessage("front.utilities.closeFilters") ? implode(".", $ʟ_contributteTranslationPrefix) . "." . "front.utilities.closeFilters" : "front.utilities.closeFilters";
223: }
224:
225: echo LR\Filters::escapeHtmlText(call_user_func($this->filters->translate, $ʟ_contributteTranslationMessage));
226: echo '
227: </a>
228: ';
229: $_tmp = $this->global->uiControl->getComponent("priceFilterMobile");
230: if ($_tmp instanceof Nette\Application\UI\Renderable) $_tmp->redrawControl(null, false);
231: $_tmp->render();
232: $_tmp = $this->global->uiControl->getComponent("productFilter");
233: if ($_tmp instanceof Nette\Application\UI\Renderable) $_tmp->redrawControl(null, false);
234: $_tmp->render();
235: echo ' </div>
1: {varType Ideatech\Eshop\Model\Category\Entity\Category $category}
2: {varType App\ElasticModule\Data\ProductSearchFilters $filters}
3: {varType string $locale}
4: {varType string $view}
5: {varType Ideatech\Eshop\Model\Brand\Entity\Brand|null $selectedBrand}
6: {block title}{$category->translate($locale)->getSeoTitle() ? $category->translate($locale)->getSeoTitle() : $category->translate($locale)->getTitle()}{if count($filters->getOrigin()) === 1} z {$filters->getOrigin()[0]}{/if}{if $selectedBrand} značky {$selectedBrand->translate($locale)->getTitle()}{/if}{if $filters->getStock()} skladem{/if}{/block}
7: {block description}{$category->translate($locale)->getSeoDescription() ? $category->translate($locale)->getSeoDescription() : $category->translate($locale)->getDescription()|stripHtml|truncate:160}{/block}
8: {block head}
9: {include parent}
10: {if $nextPage > 2}
11: <link rel="prev" href="{plink //this, page => $nextPage - 2}">
12: {/if}
13: {if $nextCount > 0}
14: <link rel="next" href="{plink //this, page => $nextPage}">
15: {/if}
299:
300: if (!$block) {
301: $hint = ($t = Latte\Helpers::getSuggestion($this->getBlockNames($layer), $name))
302: ? ", did you mean '$t'?"
303: : '.';
304: $name = $layer ? "$layer $name" : $name;
305: throw new Latte\RuntimeException("Cannot include undefined block '$name'$hint");
306: }
307:
308: $this->filter(
309: function () use ($block, $params): void { reset($block->functions)($params); },
310: $mod,
311: $block->contentType,
312: "block $name"
313: );
354: $block->functions = array_merge($block->functions, $functions);
355: }
356:
357:
358: private function filter(callable $function, $mod, string $contentType, string $name): void
362: {
363: if ($mod === null || $mod === $contentType) {
364: $function();
365:
366: } elseif ($mod instanceof \Closure) {
367: echo $mod($this->capture($function), $contentType);
368:
298: : ($this->blocks[self::LAYER_LOCAL][$name] ?? $this->blocks[self::LAYER_TOP][$name] ?? null);
299:
300: if (!$block) {
301: $hint = ($t = Latte\Helpers::getSuggestion($this->getBlockNames($layer), $name))
302: ? ", did you mean '$t'?"
303: : '.';
304: $name = $layer ? "$layer $name" : $name;
305: throw new Latte\RuntimeException("Cannot include undefined block '$name'$hint");
306: }
307:
308: $this->filter(
309: function () use ($block, $params): void { reset($block->functions)($params); },
310: $mod,
311: $block->contentType,
312: "block $name"
| $function |
|
| $mod | 'html'
|
| $contentType | 'html'
|
| $name | 'block content'
|
189: if ($_tmp instanceof Nette\Application\UI\Renderable) $_tmp->redrawControl(null, false);
190: $_tmp->renderCart();
191: } else {
192: $_tmp = $this->global->uiControl->getComponent("header");
193: if ($_tmp instanceof Nette\Application\UI\Renderable) $_tmp->redrawControl(null, false);
194: $_tmp->render();
195: }
196: echo '
197: <main class="main">
198: ';
199: $this->renderBlock('content', [], 'html') /* line 132 */;
200: if (!$wholesale) {
201: echo ' <div class="modal modal--popup micromodal-slide" id="modalAddToBasket" aria-hidden="true">
202: <div id="';
203: echo htmlspecialchars($this->global->snippetDriver->getHtmlId('addedProduct'));
122: {control headerNotifications}
123: {* Header *}
124: {if $presenter->isLinkCurrent(':Front:OrderCart:*') || $presenter->isLinkCurrent(':Front:OrderPayment:*') || $presenter->isLinkCurrent(':Front:OrderPerson:*') || $presenter->isLinkCurrent(':Front:OrderThanks:*')}
125: {control header:cart}
126: {else}
127: {control header}
128: {/if}
129:
130: {* Main *}
131: <main class="main">
132: {include content}
133: {* Modal, který se zobrazí po přidání produktu do košíku - vypíše obrázek a informace o produktu včetně ceny*}
134: <div class="modal modal--popup micromodal-slide" id="modalAddToBasket" aria-hidden="true" n:if="!$wholesale">
135: {snippet addedProduct}
136: {ifset $addedProduct}
| $name | 'content'
|
| $params | array (0)
|
| $mod | 'html'
|
161: public function render(?string $block = null): void
166: {
167: $level = ob_get_level();
168: try {
169: $this->prepare();
170: if (!$this->doRender($block)) {
171: $this->main();
172: }
173:
174: } catch (\Throwable $e) {
175: while (ob_get_level() > $level) {
193:
194: if ($this->referenceType === 'import') {
195: if ($this->parentName) {
196: throw new Latte\RuntimeException('Imported template cannot use {extends} or {layout}, use {import}');
197: }
198:
199: } elseif ($this->parentName) { ob_start(function () {});
201: $this->params = $this->main();
202: ob_end_clean();
203: $this->createTemplate($this->parentName, $this->params, 'extends')->render($block);
204:
205: } elseif ($block !== null) { $this->renderBlock($block, $this->params);
207:
160:
161: public function render(?string $block = null): void
166: {
167: $level = ob_get_level();
168: try {
169: $this->prepare();
170: if (!$this->doRender($block)) {
171: $this->main();
172: }
173:
174: } catch (\Throwable $e) {
193:
194: if ($this->referenceType === 'import') {
195: if ($this->parentName) {
196: throw new Latte\RuntimeException('Imported template cannot use {extends} or {layout}, use {import}');
197: }
198:
199: } elseif ($this->parentName) { ob_start(function () {});
201: $this->params = $this->main();
202: ob_end_clean();
203: $this->createTemplate($this->parentName, $this->params, 'extends')->render($block);
204:
205: } elseif ($block !== null) { $this->renderBlock($block, $this->params);
207:
160:
161: public function render(?string $block = null): void
166: {
167: $level = ob_get_level();
168: try {
169: $this->prepare();
170: if (!$this->doRender($block)) {
171: $this->main();
172: }
173:
174: } catch (\Throwable $e) {
92:
93: public function render(string $name, $params = [], ?string $block = null): void
98: {
99: $template = $this->createTemplate($name, $this->processParams($params));
100: $template->global->coreCaptured = false;
101: ($this->probe)($template);
102: $template->render($block);
103: }
104:
105:
106:
36: return $this->latte;
37: }
38:
39:
40: public function render(?string $file = null, array $params = []): void
44: {
45: Nette\Utils\Arrays::toObject($params, $this);
46: $this->latte->render($file ?: $this->file, $this);
47: }
48:
49:
50:
| $name | '/srv/app/modules/FrontModule/templates/Category/default.latte'
|
| $params |
|
40: return $this->source;
41: }
42:
43:
44: public function send(Nette\Http\IRequest $httpRequest, Nette\Http\IResponse $httpResponse): void
48: {
49: if ($this->source instanceof Nette\Application\UI\Template) {
50: $this->source->render();
51:
52: } else {
53: echo $this->source;
54: }
161:
162: Arrays::invoke($this->onPresenter, $this, $this->presenter);
163: $response = $this->presenter->run(clone $request);
164:
165: if ($response instanceof Responses\ForwardResponse) {
166: $request = $response->getRequest();
167: goto process;
168: }
169:
170: Arrays::invoke($this->onResponse, $this, $response);
171: $response->send($this->httpRequest, $this->httpResponse);
172: }
173:
174:
175: public function processException(\Throwable $e): void
| $httpRequest |
|
| $httpResponse |
|
80: }
81:
82:
83: public function run(): void
87: {
88: try {
89: Arrays::invoke($this->onStartup, $this);
90: $this->processRequest($this->createInitialRequest());
91: Arrays::invoke($this->onShutdown, $this);
92:
93: } catch (\Throwable $e) {
94: Arrays::invoke($this->onError, $this, $e);
4:
5: require __DIR__ . '/../vendor/autoload.php';
6:
7: $container = App\Bootstrap::boot()
8: ->createContainer();
9:
10: $container->getByType(\Nette\Http\Response::class)->warnOnBuffer = false;
11:
12: $container
13: ->getByType(Nette\Application\Application::class)
14: ->run();