{extends 'template:1'} {block 'title'} {$_modx->setPlaceholder('placetitle', ($_modx->resource.longtitle ?: 'Штатные магнитолы для ' ~ $_modx->resource.pagetitle ~ ' на Android купить в ' ~ $city_rp ~ ' по низкой цене в интернет-магазине D-AUDIO'))} {'placetitle' | placeholder} {/block} {block 'description'} {set $description = 'Купить штатную магнитолу для ' ~ $_modx->resource.pagetitle ~ ' с CarPlay, Android Auto и навигатором можно в компании D-AUDIO. Установка в день покупки. Гарантия. Доставка по РФ. Звоните: ' ~ $_modx->config.phone } {/block} {block 'ldJsonSchema'} {set $seoTitle = ('placetitle' | placeholder)} {if $total?} {set $seoTitle = $seoTitle ~ ' (Товаров: ' ~ $total ~ ')'} {/if} {'!itemListCatalogSchema' | snippet : [ 'title' => $seoTitle, 'description' => ($_modx->resource.description ?: $description) ]} {/block} {block 'content'}
{set $razdel = $_modx->resource.parent} {if $razdel} {set $grazdel = $razdel|resource:'parent'} {/if} {if $grazdel} {set $grandrazdel = $grazdel|resource:'parent'} {/if} {if $grandrazdel} {set $ggrandrazdel = $grandrazdel|resource:'parent'} {switch $ggrandrazdel} {case 13435} {'pdoResources' | snippet : [ 'parents' => $grandrazdel, 'depth' => 0, 'limit' => 0, 'tvPrefix' => '', 'sortby' => 'pagetitle', 'sortdir' =>'ASC', 'includeTVs' => 'avatar', 'tpl' => 'category__single' 'templates' => 5, ]} {default} {/switch} {/if} {switch $grandrazdel} {case 13435} {'pdoResources' | snippet : [ 'parents' => $grazdel, 'depth' => 0, 'limit' => 0, 'tvPrefix' => '', 'sortby' => 'pagetitle', 'sortdir' =>'ASC', 'includeTVs' => 'avatar', 'tpl' => 'category__single' 'templates' => 5, ]} {*
{$razdel | resource: "parent" | mylink} > {$razdel | mylink} > {$_modx->resource.id | mylink}
*} {default} {/switch} {switch $grazdel} {case 13435} {'pdoResources' | snippet : [ 'parents' => $razdel, 'depth' => 0, 'limit' => 0, 'tvPrefix' => '', 'sortby' => 'pagetitle', 'sortdir' =>'ASC', 'includeTVs' => 'avatar', 'tpl' => 'category__single' 'templates' => 5, ]} {default} {/switch} {switch $razdel} {case 13435} {'pdoResources' | snippet : [ 'parents' => $_modx->resource.id, 'depth' => 0, 'limit' => 0, 'tvPrefix' => '', 'razdel' => true, 'sortby' => 'pagetitle', 'sortdir' =>'ASC', 'includeTVs' => 'avatar', 'tpl' => 'category__single' 'templates' => 5, ]} {default} {/switch}
{switch $_modx->resource.id} {case 13435}
{'pdoResources' | snippet : [ 'parents' => $_modx->resource.id, 'depth' => 0, 'limit' => 0, 'tvPrefix' => '', 'sortdir' =>'ASC', 'includeTVs' => 'avatar', 'tpl' => 'category__single__brands' 'templates' => 5, ]}
{default} {/switch}
{set $where = [ 'template' => 3, 'Data.image IS NOT NULL' ]} {if $_modx->config.showZero != 1} {set $where['Data.price:>'] = 0} {/if} {* 1. ФОРМИРУЕМ БРОНЕБОЙНЫЙ КЛЮЧ КЭША *} {var $get = ($.get | toJSON) | md5} {set $categoryId = $_modx->resource.id} {* 2. ОПРЕДЕЛЯЕМ ТИП ЦЕНЫ И СТАВИМ ГЛОБАЛЬНЫЙ ПЛЕЙСХОЛДЕР *} {if $_modx->user.id && ($_modx->user.id | ismember : 'OptPrice')} {set $priceType = 'opt'} {* Сохраняем в память системы, что это оптовик (0 запросов к БД в будущем) *} {set $null = $_modx->setPlaceholder('isOptUser', 1)} {else} {set $priceType = 'retail'} {set $null = $_modx->setPlaceholder('isOptUser', 0)} {/if} {* Собираем итоговый путь к файлу кэша *} {set $cacheKey = 'msearch2/html_cache/category_' ~ $categoryId ~ '/' ~ $priceType ~ '_' ~ $get} {* 3. ПРОВЕРЯЕМ КЭШ *} {if !$filter = $_modx->cacheManager->get($cacheKey)} {* Если кэша нет - запускаем mFilter2 *} {set $filter = $_modx->runSnippet('!mFilter2', [ 'element' => 'msProducts', 'class' => 'msProduct', 'parents' => $categoryId, 'checkPermissions' => 0, 'showHidden' => 0, 'showUnpublished' => 0, 'processTVs' => 0, 'suggestions' => 1, 'values_delimeter'=>';', 'limit' => 36, 'maxLimit' => 100, 'filters' => 'ms|price:number', 'showLog' => 0, 'sortby' => [ "pagetitle LIKE 'Штатная магнитола%'" => 'DESC', 'Data.price' => 'ASC' ], 'where' => $where, 'aliases'=>' ms|vendor==vendor, msopoption|size==size, ms|price==price ', 'tvPrefix' => '', 'tpls' => 'tpl.msProducts.row.fx_model_intovar_ms2option', 'ajaxMode' => '', 'paginator' => 'pdoPage', 'tplPageWrapper' => '@INLINE ', 'tplPage' => '@INLINE
  • ', 'tplPageActive' => '@INLINE
  • ', 'tplPageSkip' => '@INLINE
  • ...
  • ', 'includeThumbs' => 'normal', 'tplOuter' => 'tpl.mFilter2.outer.fx_model', 'tplFilter.outer.size' => 'tpl.mFilter2.filter.outer', 'tplFilter.row.size' => 'tpl.mFilter2.filter.size', 'tplFilter.outer.vendor' => 'tpl.mFilter2.filter.outer', 'tplFilter.row.vendor' => 'tpl.mFilter2.filter.checkbox.brand', 'tplFilter.outer.price' => 'tpl.mFilter2.filter.slider', 'tplFilter.row.price' => 'tpl.mFilter2.filter.number' ])} {* 4. СОХРАНЯЕМ В КЭШ (На 24 часа) *} {* Забираем собранные ID из плейсхолдера *} {set $jsonIds = $_modx->getPlaceholder('current_catalog_ids')} {* Кэшируем HTML *} {set $null = $_modx->cacheManager->set($cacheKey, $filter, 86400)} {* Рядом кэшируем массив ID, добавив суффикс _ids к ключу *} {set $null = $_modx->cacheManager->set($cacheKey ~ '_ids', $jsonIds, 86400)} {else} {* ЕСЛИ HTML ВЗЯТ ИЗ КЭША *} {* Достаем сохраненный массив ID из кэша *} {set $jsonIds = $_modx->cacheManager->get($cacheKey ~ '_ids')} {* И принудительно восстанавливаем плейсхолдер для сниппета микроразметки *} {set $null = $_modx->setPlaceholder('current_catalog_ids', $jsonIds)} {/if} {* 5. ПОДКЛЮЧАЕМ СКРИПТЫ *} {'!mFilterJS' | snippet} {* 6. ВЫВОДИТСЯ ГОТОВЫЙ HTML *} {if $_modx->resource.id != 13435} {$filter} {/if}
    {if $_modx->resource.content}
    {$_modx->resource.content}
    {/if} {/block} {*
    *}