{* Главная страница магазина *}
{* Слайдер *}
<div class="row">
    <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
        {if !$detect->isMobile()}
            <div class="menu-service">
                <div class="header"><a href="/tuning-centr/">Услуги тюнинг центра</a></div>
                <ul>
                    <li><a href="/tuning-centr/tuning-optiki/">Работа с оптикой</a></li>
                    <li><a href="/tuning-centr/interernye-raboty/">Интерьерные работы</a></li>
                    <li><a href="/tuning-centr/ehksterernye-raboty/">Экстерьерные работы</a></li>
                    <li><a href="/tuning-centr/dopolnitelnoe-oborudovanie/">Дополнительное оборудование</a></li>
                </ul>
            </div>
        {/if}
    </div>


    <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
        <div class="flexslider">
            <ul class="slides">

                <!-- <li style="background-size: contain !important; background: #1c1e23 url(/design/atomic/images/pereezd.jpg) no-repeat right center !important">
                 </li> -->
                <!-- <li style="background: #1c1e23 url(/design/atomic/images/slider-1.jpg) no-repeat right center !important">
                  <p>
                      <span class="big-font">Замена стекол фар</span>
                      на BMW F10, BMW X5, BMW X6
                      <span class="big-font">25 000 рублей</span>
                      <a href="/actions/zamena-stekol-far-bmw-x5-x6-f10/" class="ai-more">подробнее</a>

                  </p>
                </li> -->
                <!-- <li style="background: #1c1e23 url(/design/atomic/images/slider-2.jpg) no-repeat right center !important">
                 <p>
                     <span class="big-font">Замена ксеноновых линз на <br>биксеноновые Hella 3R<br> 20000 рублей </span>
                     Для Subaru Outback B14 и Mitsubishi Pajero 4 &nbsp;&nbsp;&nbsp;&nbsp;
                     <a href="/actions/zamena-vygorevshih-shtatnyh-linz-v-farah-na-hella-3r/" class="ai-more">подробнее</a>

                 </p>
               </li> -->

                <li style="background: #1c1e23 url(/design/atomic/images/slider-3.jpg) no-repeat right center !important">
                    <p>
                        <span class="big-font">Ремонт запотевания фар</span>

                        <span class="big-font"> от 3000 рублей</span>
                        <a href="/tuning-centr/ustranenie-zapotevanija-far/" class="ai-more">подробнее</a>
                    </p>
                </li>

                <!-- li style="background: #1c1e23 url(/design/atomic/images/photo_2022-10-18_11-25-02.jpg) no-repeat right center !important">
                  <p>
                      <span class="big-font"></span>
                      <span class="big-font"></span>
                  </p>
                </li -->
            </ul>
        </div>
    </div>


</div>


<div class="row">
    <div class="col-sm-12">
        {* Для того чтобы обернуть центральный блок в шаблон, отличный от index.tpl *}
        {* Укажите нужный шаблон строкой ниже. Это работает и для других модулей *}
        {$wrapper = 'index.tpl' scope=parent}
        {* Заголовок страницы *}
        {*<h1>$page->header</h1>*}
        {* Тело страницы *}
        {* $page->body *}
        {* Рекомендуемые товары *}
        {if $detect->isMobile() && !$detect->isTablet()}
            {assign var="x" value=4}
        {else}
            {assign var="x" value=3}
        {/if}
        {get_featured_products var=featured_products limit=$x}
        {if $featured_products}
            <!-- Список товаров-->
            <div class="title">Рекомендуемые товары</div>
            <div class="home-output row">
                {foreach $featured_products as $product}
                    <!-- Товар22-->
                    <div class="product col-sm-3 col-xs-6">
                        <!-- Фото товара22 -->
                        {if $product->image}
                            <div class="product-image">
                                <a href="/products/{$product->url}/" class="w"><img class="img-thumbnail"
                                                                                    src="{$product->image->filename|resize:242:128}"
                                                                                    alt="{$product->name|escape}"></a>
                            </div>
                        {/if}
                        <!-- Фото товара (The End) -->
                        <!-- Название товара -->
                        <a class="product-name" data-product="{$product->id}"
                           href="/products/{$product->url}/">{$product->name|escape}</a>
                        <!-- Название товара (The End) -->
                        {if $product->variants|count > 0}
                            <!-- Выбор варианта товара -->
                            {*<formss class="variants" action="/cart">*}
                            {foreach $product->variants as $v}
                                {if  $v@first || $v->price<$pmin}
                                    {assign var="pmin" value=$v->price}
                                    {assign var="vmin" value=$v->id}
                                    {assign var="nmin" value=$v->name}
                                    {assign var="smin" value=$v->stock}
                                {/if}
                            {/foreach}
                            <form class="variants" action="/cart">
                                <input style="display:none" name="variant" value="{$vmin}" type="radio" checked>

                                <div class="col-sm-6">
                                    <span class="product-price"><small>от</small> {$pmin|convert} <small>{$currency->sign|escape}</small></span>
                                </div>
                                <div class="col-sm-6">
                                    {if $smin !='0'}
                                        <input type="submit" class="btn btn-danger" value="в корзину"
                                               data-result-text="добавлено">
                                    {else}
                                        <input type="button" class="btn btn-danger preorder"
                                               data-id="{$product->variant->id}" value="Предзаказ">
                                    {/if}
                                </div>
                            </form>
                            <!-- Выбор варианта товара (The End) -->
                        {else}
                            <p>Нет в наличии</p>
                            <input type="button" class="btn btn-danger preorder" data-id="{$product->variant->id}"
                                   value="Предзаказ">
                        {/if}
                        <div class="none" style="display: none">
                            <div class="modal2 dialog amount well" id="amount{$product->variant->id}">
                                <form class="ajaxform preorder form-horizontal" action="ajax/preorder.php"
                                      method="post">
                                    <input name="variant" value="{$product->variant->id}" type="hidden"/>
                                    <input name="comment" value="Предзаказ на {$product->name|escape:'html'}"
                                           type="hidden"/>
                                    <span class="header h22">Предзаказ</span>
                                    <p><a href="/products/{$product->url}/">{$product->name|escape}</a></p>
                                    <p>Как только товар будет в наличии, наш менеджер свяжется с Вами.</p>
                                    <div class="line form">
                                        <div class="form-group">
                                            <label class=" col-sm-3 control-label">Имя</label>
                                            <span class=" col-sm-9"><input name="name" class="form-control" type="text"
                                                                           value="{$name|escape}"/></span>
                                        </div>
                                        <div class="form-group">
                                            <label class=" col-sm-3 control-label">Фамилия</label>
                                            <span class=" col-sm-9"><input name="name2" class="form-control" type="text"
                                                                           value="{$name2|escape}"/></span>
                                        </div>
                                        <div class="form-group">
                                            <label class=" col-sm-3 control-label">Email</label>
                                            <span class=" col-sm-9"><input name="email" class="form-control" type="text"
                                                                           value="{$email|escape}"/></span>
                                        </div>
                                        <div class="form-group">
                                            <label class=" col-sm-3 control-label">Телефон</label>
                                            <span class=" col-sm-9"><input name="phone" class="form-control" type="text"
                                                                           value="{$phone|escape}"/></span>
                                        </div>
                                    </div>
                                    <p class="clear"></p>
                                    <p class="pull-right"><input class="button btn btn-danger" type="submit"
                                                                 value="Отправить"/></p>
                                </form>
                            </div>
                        </div>
                    </div>
                    <!-- Товар (The End)-->
                {/foreach}
            </div>
        {/if}

        <!-- Меню услуг -->
        {* Услуги на главной *}
        {if $home_services}
            {*<div class="title">Популярные услуги</div>*}
            {foreach $home_services as $top}
                <div class="title">{$top->name|escape}</div>
                <div class="row">
                    {foreach $top->children as $s}
                        <div class="service-unit col-sm-3">
                            <div class="service-box">
                                <a href="/{$services_root}{$s->url}/" class="tumb">
                                    {if $s->image}
                                        <img src="{$s->image|resizepage:270:235:0:1}" alt="{$s->name|escape}">
                                    {else}
                                        <img src="/files/page/default.jpg" alt="{$s->name|escape}">
                                    {/if}
                                </a>
                                <a class="service-name" href="/{$services_root}{$s->url}/">{$s->name|escape}</a>
                            </div>
                        </div>
                    {/foreach}
                </div>
                <div class="service-link"><a href="/{$services_root}{$top->url}/">все услуги</a></div>
            {/foreach}
        {/if}
        <!-- Меню услуг  (The End) -->

        {if $page->body}
            <div>{$page->body}</div>{/if}

        <!-- Меню статей -->
        {* Выбираем в переменную $last_articles последние записи *}
        {get_last_articles var=last_articles limit=6}
        {if $last_articles}
            <div class="title">Последние выполненные работы</div>
            <div class="blog-menu row" style="margin-bottom:0">
                {foreach $last_articles as $a}
                    <div class="col-sm-4">
                        <div class="blog-unit">
                            <a href="/nashi-raboty/{$a->url}/" class="w"><span class="img">
                         
						 	{if $a->image}
                                <img src="{$a->image|resizepage:360:232:0:1}" alt="{$a->name|escape}">


{else}


                                <img src="/files/page/default365x235.jpg" alt="{$a->name|escape}">
                            {/if}
				</span>
                                <span class="name">{$a->name|escape}</span></a>
                            <div class="blog-annotation">{$a->annotation}</div>
                        </div>
                    </div>
                {/foreach}
            </div>
            <div class="service-link"><a href="/nashi-raboty/">Смотреть все работы</a></div>
        {/if}
        <!-- Меню статей  (The End) -->


             <div class="row">
            <div class="col-sm-3 col-xs-12">
                {include file='sidebar_catalog.tpl'}
            </div>
            <div class="col-sm-9 col-xs-12">
                {* Новинки *}
                {if $detect->isMobile() && !$detect->isTablet()}
                    {assign var="x" value=4}
                {else}
                    {assign var="x" value=6}
                {/if}
                {get_new_products var=new_products limit=$x}
                {if $new_products}
                <div class="title">Новинки</div>
                <!-- Список товаров-->
                <div class="home-output row">
                    {foreach $new_products as $product}
                        <!-- Товар-->
                        <div class="col-sm-4 col-xs-6">
                            <div class="product">
                                <!-- Фото товара -->

                                <div class="product-image">
                                    <a href="/products/{$product->url}/" class="w">
                                        {if $product->image}<img class="img-thumbnail"
                                                                 src="{$product->image->filename|resizeProduct:221:168:1}"
                                                                 alt="{$product->name|escape}">
                                        {else}
                                            <img src="/images/zag2.jpg" class="img-thumbnail" alt="">
                                        {/if}
                                    </a>
                                </div>

                                <!-- Фото товара (The End) -->
                                <!-- Название товара -->
                                <a class="product-name" data-product="{$product->id}"
                                   href="/products/{$product->url}/">{$product->name|escape}</a>
                                <!-- Название товара (The End) -->
                                {if $product->variants|count > 0}
                                    <!-- Выбор варианта товара4 -->

                                    {foreach $product->variants as $v}
                                        {if  $v@first || $v->price<$pmin}
                                            {assign var="pmin" value=$v->price}
                                            {assign var="vmin" value=$v->id}
                                            {assign var="nmin" value=$v->name}
                                            {assign var="smin" value=$v->stock}
                                        {/if}
                                    {/foreach}
                                    <form class="variants" action="/cart">
                                        <input style="display:none" name="variant" value="{$vmin}" type="radio" checked>

                                        <div class="col-sm-6">
                                            <span class="product-price"> {$pmin|convert} <small>{$currency->sign|escape}</small></span>
                                        </div>

                                        <div class="col-sm-6">
                                            {if $smin !='0'}
                                                <button type="submit" class="btn cart-btn" data-result-text="добавлено">
                                                    в корзину
                                                </button>
                                            {else}
                                                <button type="button" class="btn preorder cart-btn"
                                                        data-id="{$product->variant->id}">Предзаказ
                                                </button>
                                            {/if}
                                        </div>

                                    </form>
                                    <!-- Выбор варианта товара (The End) -->
                                {else}
                                    <p>Нет в наличии</p>
                                    <input type="button" class="btn btn-danger preorder"
                                           data-id="{$product->variant->id}" value="Предзаказ">
                                {/if}
                                <div class="none" style="display: none">
                                    <div class="modal2 dialog amount well" id="amount{$product->variant->id}">
                                        <form class="ajaxform preorder form-horizontal" action="ajax/preorder.php"
                                              method="post">
                                            <input name="variant" value="{$product->variant->id}" type="hidden"/>
                                            <input name="comment" value="Предзаказ на {$product->name|escape:'html'}"
                                                   type="hidden"/>
                                            <span class="header h22">Предзаказ</span>
                                            <p><a href="/products/{$product->url}/">{$product->name|escape}</a></p>
                                            <div class="line form">
                                                <div class="form-group">
                                                    <label class=" col-sm-3 control-label">Имя</label>
                                                    <span class=" col-sm-9"><input name="name" class="form-control"
                                                                                   type="text" value="{$name|escape}"/></span>
                                                </div>
                                                <div class="form-group">
                                                    <label class=" col-sm-3 control-label">Фамилия</label>
                                                    <span class=" col-sm-9"><input name="name2" class="form-control"
                                                                                   type="text" value="{$name2|escape}"/></span>
                                                </div>
                                                <div class="form-group">
                                                    <label class=" col-sm-3 control-label">Email</label>
                                                    <span class=" col-sm-9"><input name="email" class="form-control"
                                                                                   type="text" value="{$email|escape}"/></span>
                                                </div>
                                                <div class="form-group">
                                                    <label class=" col-sm-3 control-label">Телефон</label>
                                                    <span class=" col-sm-9"><input name="phone" class="form-control"
                                                                                   type="text" value="{$phone|escape}"/></span>
                                                </div>
                                            </div>
                                            <p class="clear"></p>
                                            <p class="pull-right"><input class="button btn btn-danger" type="submit"
                                                                         value="Отправить"/></p>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- Товар (The End)-->
                    {/foreach}
                </div>
            </div>
        </div>
        {/if}
    </div>
</div>

            