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'
|
40: new \Spameri\ElasticQuery\Aggregation\RangeValueCollection(
41: new \Spameri\ElasticQuery\Aggregation\RangeValue(Stock::INSTOCK, 1, null)
42: )
43: )
44: )
45: );
46:
47: $query->options()->changeSize(1);
48:
49: try {
50: $attributeAggregations = $this->productService->getAllBy($query);
51: } catch (\Spameri\Elastic\Exception\DocumentNotFound $e) {
52: return [];
53: }
54:
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: {
165: return $this->productStockFilterFacade->getStockValuesCount(clone $this->filters);
166: }
167:
168: public function getAlcoholSizeValuesCount(): array
169: {
public function blockStock(array $ʟ_args): void
367: {
368: extract($this->params);
369: extract($ʟ_args);
370: unset($ʟ_args);
371: $this->global->snippetDriver->enter("stock", 'static');
372: try {
373: echo ' ';
374: echo end($this->global->formsStack)["sort"]->getControl() ;
375: echo "\n";
376: $countsStock = $control->getStockValuesCount() /* line 20 */;
377: $iterations = 0;
378: foreach ($form['stock']->items as $key => $label) {
379: echo ' <div class="col m-b-10">
380: <label class="custom-checkbox stock-checkbox">
10: <div class="category-filter__item jsCategoryFilterItem">
11: <div class="category-filter__header jsAccordionHeader jsAccordionHeaderDesktopOpen"
12: data-parent="category-filter">
13: <span class="category-filter__tag">{_front.product.availability}</span>
14: <span class="c-1 link link--arrow link--arrow-up">{_front.utilities.show}</span>
15: <span class="c-1 link link--arrow link--arrow-down">{_front.utilities.hide}</span>
16: </div>
17: <div class="category-filter__body">
18: <div class="row" n:snippet="stock">
19: {input sort}
20: {var $countsStock = $control->getStockValuesCount()}
21: {foreach $form[stock]->items as $key => $label}
22: <div class="col m-b-10">
23: <label class="custom-checkbox stock-checkbox">
24: <input type="checkbox" n:name="stock:$key" {ifset $countsStock[$key]}{else}disabled{/ifset}
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 stock'
|
78: }
79:
80: echo LR\Filters::escapeHtmlText(call_user_func($this->filters->translate, $ʟ_contributteTranslationMessage));
81: echo '</span>
82: </div>
83: <div class="category-filter__body">
84: <div class="row"';
85: echo ' id="' . htmlspecialchars($this->global->snippetDriver->getHtmlId('stock')) . '"';
86: echo '>
87: ';
88: $this->renderBlock('stock', [], null, 'snippet');
89: echo ' </div>
90: </div>
91: </div>
92:
1: {varType App\ElasticModule\Data\ProductSearchFilters $filters}
2: {varType array $attributeIds}
3: {varType array $attributeValues}
4: {varType App\FrontModule\Components\ProductFilterControl $control}
5: {varType string $locale}
6: {varType Ideatech\Eshop\Model\Attribute\Entity\Attribute[] $attributes}
7:
8: {snippetArea form}
9: {form filterForm, class => 'ajax'}
10: <div class="category-filter__item jsCategoryFilterItem">
11: <div class="category-filter__header jsAccordionHeader jsAccordionHeaderDesktopOpen"
12: data-parent="category-filter">
13: <span class="category-filter__tag">{_front.product.availability}</span>
14: <span class="c-1 link link--arrow link--arrow-up">{_front.utilities.show}</span>
15: <span class="c-1 link link--arrow link--arrow-down">{_front.utilities.hide}</span>
| $name | 'stock'
|
| $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', 'stock' => 'blockStock', 'origin' => 'blockOrigin', 'brand' => 'blockBrand', 'alcohol' => 'blockAlcohol'],
10: ];
11:
12:
13: public function main(): array
14: {
15: extract($this->params);
16: echo "\n";
17: $this->renderBlock('form', [], null, 'snippet') /* line 8 */;
18: echo "\n";
19: return get_defined_vars();
20: }
21:
1: {varType App\ElasticModule\Data\ProductSearchFilters $filters}
2: {varType array $attributeIds}
3: {varType array $attributeValues}
4: {varType App\FrontModule\Components\ProductFilterControl $control}
5: {varType string $locale}
6: {varType Ideatech\Eshop\Model\Attribute\Entity\Attribute[] $attributes}
7:
8: {snippetArea form}
9: {form filterForm, class => 'ajax'}
10: <div class="category-filter__item jsCategoryFilterItem">
11: <div class="category-filter__header jsAccordionHeader jsAccordionHeaderDesktopOpen"
12: data-parent="category-filter">
13: <span class="category-filter__tag">{_front.product.availability}</span>
14: <span class="c-1 link link--arrow link--arrow-up">{_front.utilities.show}</span>
15: <span class="c-1 link link--arrow link--arrow-down">{_front.utilities.hide}</span>
| $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/default.latte'
|
| $params |
|
21: $this->template->setFile(self::TEMPLATE);
22:
23: $this->template->filters = $this->filters;
24: $this->template->attributes = $this->attributesFacade->getAttributesBy(['filterable' => true]);
25:
26: $this->template->attributeIds = $this->attributeIds;
27: $this->template->attributeValues = $this->attributeValues;
28:
29: $this->template->form = $this['filterForm'];
30:
31: $this->template->render();
32: }
33:
34: protected function createComponentFilterForm(): Form
35: {
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>
236: </div>
237: </div>
238: </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();