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: {
7: {
8:
9: public function main(): array
10: {
11: extract($this->params);
12: echo "\n";
13: $form = $this->global->formsStack[] = $this->global->uiControl["priceForm"];
14: Nette\Bridges\FormsLatte\Runtime::initializeForm($form);
15: echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form, []) ;
16: echo "\n";
17: $minMax = $control->getPriceValuesCount() /* line 6 */;
18: if (isset($minMax['minPrice'])) {
19: echo ' <div class="none xsDesktop-block">
20: <div class="custom-slider-container">
21: <div class="custom-slider-input">
1: {varType App\ElasticModule\Data\ProductSearchFilters $filters}
2: {varType App\FrontModule\Components\ProductFilterControl $control}
3: {varType bool $personalCollectionDiscount}
4:
5: {form priceForm}
6: {var $minMax = $control->getPriceValuesCount()}
7: {ifset $minMax['minPrice']}
8: <div class="none xsDesktop-block">
9: <div class="custom-slider-container">
10: <div class="custom-slider-input">
11: <span class="custom-slider-input__text">od</span>
12: {var $minValue = $control->getPresenter()->min ?: $minMax['minPrice']}
13: {var $maxValue = $control->getPresenter()->max ?: $minMax['maxPrice']}
14: <input type="text"
15: n:name="minPrice"
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/price.latte'
|
| $params |
|
11: class PriceFilterControl extends FilterControl
12: {
13: public const TEMPLATE = __DIR__ . '/../templates/components/ProductFilter/price.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: {
342: public function blockCategoryList_priceFilter(array $ʟ_args): void
344: {
345: extract($this->params);
346: extract($ʟ_args);
347: unset($ʟ_args);
348: $this->global->snippetDriver->enter("categoryList-priceFilter", 'static');
349: try {
350: $_tmp = $this->global->uiControl->getComponent("priceFilter");
351: if ($_tmp instanceof Nette\Application\UI\Renderable) $_tmp->redrawControl(null, false);
352: $_tmp->render();
353: echo ' <div class="xsDesktop-none m-l-5">
354: ';
355: if ($view === 'grid') {
356: echo ' <a class="ajax flex flex-ai-c" href="';
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 | null
|
| $contentType | 'html'
|
| $name | 'block categoryList-priceFilter'
|
177: <div class="category-list-sort"';
178: echo ' id="' . htmlspecialchars($this->global->snippetDriver->getHtmlId('categoryList-sort')) . '"';
179: echo '>
180: ';
181: $this->renderBlock('categoryList-sort', [], null, 'snippet');
182: echo ' </div>
183: </div>
184: <div id="';
185: echo htmlspecialchars($this->global->snippetDriver->getHtmlId('categoryList-priceFilter'));
186: echo '">';
187: $this->renderBlock('categoryList-priceFilter', [], null, 'snippet') /* line 66 */;
188: echo '</div>
189: </div>
190: <div class="w-100p">
191: <div class="category-filter-container"
56: <option value="{plink this, 'sort' => null}">{_front.product.recommended}</option>
57: <option {if $presenter->getParameter('sort') === 'nejlevnejsi'}selected{/if}
58: value="{plink this, 'sort' => 'nejlevnejsi'}">{_front.product.cheapest}
59: </option>
60: <option {if $presenter->getParameter('sort') === 'nejdrazsi'}selected{/if}
61: value="{plink this, 'sort' => 'nejdrazsi'}">{_front.product.mostExpensive}
62: </option>
63: </select>
64: </div>
65: </div>
66: {snippet categoryList-priceFilter}
67: {control priceFilter}
68: <div class="xsDesktop-none m-l-5">
69: {if $view === 'grid'}
70: <a class="ajax flex flex-ai-c" href="{plink this, view => 'row'}"><img
| $name | 'categoryList-priceFilter'
|
| $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 | '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();