Поправить код

Тема в разделе "Битрикс", создана пользователем xoff, 12 дек 2016.

  1. xoff

    xoff

    Регистрация:
    2 сен 2013
    Сообщения:
    74
    Симпатии:
    13
    Помогите пожалуйста поправить код)

    PHP:
    <?if (($arResult['PROPERTIES']['SAMOVYVOZM']['VALUE'] != '')and($arResult['MIN_PRICE']['VALUE'] != '')){?>
        <select id="kol-type">
            <option value="type-one">шт.</option>
            <option value="type-two">м2</option>
            </select>
        <?} else {?>
        <select id="kol-type">
            <option value="type-one">шт.</option>
        </select>
        <?}?>
    Я как понимаю должно быть что-то вроде 3-х условий:
    1. Когда указана только м2 - показывать м2
    2. Когда указана только шт - показывать шт
    3. Когда указано и то и другое - показывать и шт и м2

    А сейчас получается так, что когда не указана цена за шт. выбор м2 не появляется.
    [​IMG]


    Символьный код:
    [​IMG]


    Полностью код страницы:
    PHP:
    <?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
    /** @var array $templateData */
    /** @var @global CMain $APPLICATION */
    use Bitrix\Main\Loader;

    global 
    $APPLICATION;
    global 
    $is_cart;
    $is_cart=true;

    if (isset(
    $templateData['TEMPLATE_THEME']))
    {
        
    $APPLICATION->SetAdditionalCSS($templateData['TEMPLATE_THEME']);
    }
    if (isset(
    $templateData['TEMPLATE_LIBRARY']) && !empty($templateData['TEMPLATE_LIBRARY']))
    {
        
    $loadCurrency false;
        if (!empty(
    $templateData['CURRENCIES']))
            
    $loadCurrency Loader::includeModule('currency');
        
    CJSCore::Init($templateData['TEMPLATE_LIBRARY']);
        if (
    $loadCurrency)
        {
        
    ?>
        <script type="text/javascript">
            BX.Currency.setCurrencies(<? echo $templateData['CURRENCIES']; ?>);
        </script>
    <?
        }
    }
    if (isset($templateData['JS_OBJ']))
    {
    ?><script type="text/javascript">
    BX.ready(BX.defer(function(){
        if (!!window.<? echo $templateData['JS_OBJ']; ?>)
        {
            window.<? echo $templateData['JS_OBJ']; ?>.allowViewedCount(true);
        }
    }));
    </script><?
    }
    ?>

    <?php
    if(isset($arResult['arResult'])) {
       
    $arResult =& $arResult['arResult'];
       global 
    $MESS;
       include_once(
    GetLangFileName(dirname(__FILE__).'/lang/''/template.php'));
    } else {
       return;
    }
    ?>

    <?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
    /** @var array $arParams */
    /** @var array $arResult */
    /** @global CMain $APPLICATION */
    /** @global CUser $USER */
    /** @global CDatabase $DB */
    /** @var CBitrixComponentTemplate $this */
    /** @var string $templateName */
    /** @var string $templateFile */
    /** @var string $templateFolder */
    /** @var string $componentPath */
    /** @var CBitrixComponent $component */
    $this->setFrameMode(true);
    $templateLibrary = array('popup');
    $currencyList = '';
    if (!empty($arResult['CURRENCIES']))
    {
        $templateLibrary[] = 'currency';
        $currencyList = CUtil::PhpToJSObject($arResult['CURRENCIES'], false, true, true);
    }
    $templateData = array(
        'TEMPLATE_CLASS' => 'bx_'.$arParams['TEMPLATE_THEME'],
        'TEMPLATE_LIBRARY' => $templateLibrary,
        'CURRENCIES' => $currencyList
    );
    unset($currencyList, $templateLibrary);

    $strMainID = $this->GetEditAreaId($arResult['ID']);
    $arItemIDs = array(
        'ID' => $strMainID,
        'PICT' => $strMainID.'_pict',
        'DISCOUNT_PICT_ID' => $strMainID.'_dsc_pict',
        'STICKER_ID' => $strMainID.'_sticker',
        'BIG_SLIDER_ID' => $strMainID.'_big_slider',
        'BIG_IMG_CONT_ID' => $strMainID.'_bigimg_cont',
        'SLIDER_CONT_ID' => $strMainID.'_slider_cont',
        'SLIDER_LIST' => $strMainID.'_slider_list',
        'SLIDER_LEFT' => $strMainID.'_slider_left',
        'SLIDER_RIGHT' => $strMainID.'_slider_right',
        'OLD_PRICE' => $strMainID.'_old_price',
        'PRICE' => $strMainID.'_price',
        'DISCOUNT_PRICE' => $strMainID.'_price_discount',
        'SLIDER_CONT_OF_ID' => $strMainID.'_slider_cont_',
        'SLIDER_LIST_OF_ID' => $strMainID.'_slider_list_',
        'SLIDER_LEFT_OF_ID' => $strMainID.'_slider_left_',
        'SLIDER_RIGHT_OF_ID' => $strMainID.'_slider_right_',
        'QUANTITY' => $strMainID.'_quantity',
        'QUANTITY_DOWN' => $strMainID.'_quant_down',
        'QUANTITY_UP' => $strMainID.'_quant_up',
        'QUANTITY_MEASURE' => $strMainID.'_quant_measure',
        'QUANTITY_LIMIT' => $strMainID.'_quant_limit',
        'BASIS_PRICE' => $strMainID.'_basis_price',
        'BUY_LINK' => $strMainID.'_buy_link',
        'ADD_BASKET_LINK' => $strMainID.'_add_basket_link',
        'BASKET_ACTIONS' => $strMainID.'_basket_actions',
        'NOT_AVAILABLE_MESS' => $strMainID.'_not_avail',
        'COMPARE_LINK' => $strMainID.'_compare_link',
        'PROP' => $strMainID.'_prop_',
        'PROP_DIV' => $strMainID.'_skudiv',
        'DISPLAY_PROP_DIV' => $strMainID.'_sku_prop',
        'OFFER_GROUP' => $strMainID.'_set_group_',
        'BASKET_PROP_DIV' => $strMainID.'_basket_prop',
    );
    $strObName = 'ob'.preg_replace("/[^a-zA-Z0-9_]/", "x", $strMainID);
    $templateData['JS_OBJ'] = $strObName;

    $strTitle = (
        isset($arResult["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"]) && $arResult["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"] != ''
        ? $arResult["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"]
        : $arResult['NAME']
    );
    $strAlt = (
        isset($arResult["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"]) && $arResult["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"] != ''
        ? $arResult["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"]
        : $arResult['NAME']
    );
    ?>
    <?
    $pricesArr = CCatalogProduct::GetOptimalPrice($arResult['ID']);
    ?>

    <div id="<? echo $arItemIDs['ID']; ?>" class="bx_item_detail <? echo $templateData['TEMPLATE_CLASS']; ?> product-details"><!--product-details-->
                            <div class="col-sm-5 product-item col-xs-12">
                                <div class="view-product">
                                    <?$arWaterMark = Array(
                                        array(
                                            "name" => "watermark",
                                            "position" => "center", // Положение
                                            "type" => "image",
                                            "size" => "real",
                                            "file" => $_SERVER["DOCUMENT_ROOT"].'/bitrix/templates/main/images/home/watermark1.png', // Путь к картинке
                                            "fill" => "exact",
                                        )
                                    );
                                    $arFileTmp = CFile::ResizeImageGet(
                                        $arResult["PREVIEW_PICTURE"],
                                        array("width" => 500),
                                        BX_RESIZE_IMAGE_EXACT,
                                        true,
                                        $arWaterMark
                                    );?>
                                    <?if ($arResult['PROPERTIES']['SALE']['VALUE'] == 'Y'){?>
                                        <img src="/bitrix/templates/main/images/home/sale.png" class="new" alt="Распродажа - <?=$arResult["NAME"]?>">
                                    <?} elseif ($arResult['PROPERTIES']['HIT']['VALUE'] == 'Y'){?>
                                        <img src="/bitrix/templates/main/images/home/hit.png" class="new" alt="Хит продаж - <?=$arResult["NAME"]?>">
                                    <?} elseif ($arResult['PROPERTIES']['NEW']['VALUE'] == 'Y'){?>
                                        <img src="/bitrix/templates/main/images/home/new.png" class="new" alt="Новинка - <?=$arResult["NAME"]?>">
                                    <?}?>

                                    <?if(!empty($arFileTmp['src'])){?>
                                        <a href="<?=$arFileTmp['src']?>" rel="prettyPhoto[tovar]">
                                        <img src="<?=$arFileTmp['src']?>" alt="<?=$arResult['NAME']?>"/>
                                    <?} else {?>
                                        <img src="/bitrix/templates/main/images/empty.jpg" alt="<?=$arResult['NAME']?>"/>
                                    <?}?>
                                        <?if ($arResult['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'] > 0){?>
                                                    <div class="bx_stick_disc-item" style="display:;">-<?=$arResult['MIN_PRICE']['DISCOUNT_DIFF_PERCENT']?>%
                                                    </div>
                                                <?}?>
                                    </a>
                                </div>
                                <?if (!empty($arResult['PROPERTIES']['MORE_PHOTO']['VALUE'])){?>
                                <div id="similar-product" class="carousel slide" data-ride="carousel">
                                   
                                      <!-- Wrapper for slides -->
                                        <div class="carousel-inner item-slide">
                                            <?$flag = 1?>
                                            <?$i = 0?>
                                            <?foreach ($arResult['PROPERTIES']['MORE_PHOTO']['VALUE'] as $photo) {?>
                                                <?if ($i==0){?>
                                                    <?if ($flag == 1){?>
                                                        <div class="item active">
                                                        <?$flag = 0;?>
                                                    <?} else {?>
                                                        <div class="item">
                                                    <?}?>
                                                <?}?>
                                                <?$arWaterMark2 = Array(
                                                    array(
                                                        "name" => "watermark",
                                                        "position" => "center", // Положение
                                                        "type" => "image",
                                                        "size" => "real",
                                                        "file" => $_SERVER["DOCUMENT_ROOT"].'/bitrix/templates/main/images/home/watermark1.png', // Путь к картинке
                                                        "fill" => "exact",
                                                    )
                                                );
                                                $arFileTmp2 = CFile::ResizeImageGet(
                                                    $photo,
                                                    array(),
                                                    BX_RESIZE_IMAGE_EXACT,
                                                    true,
                                                    $arWaterMark2
                                                );?>
                                                <a href="<?=$arFileTmp2['src']?>" rel="prettyPhoto[tovar]">
                                                    <img class="slider-img-detail" src="<?=CFile::GetPath($photo)?>" alt="<?=$arResult['NAME']?>">
                                                </a>
                                               
                                                <?$i++;?>
                                                <?if ($i==3){?>
                                                    </div>
                                                    <?$i=0;?>
                                                <?}?>
                                            <?}?>
                                            <?if($i > 0){?>
                                                </div>
                                            <?}?>
                                        </div>

                                      <!-- Controls -->
                                      <a class="left-item item-control" href="#similar-product" data-slide="prev">
                                        <i class="fa fa-angle-left"></i>
                                      </a>
                                      <a class="right-item item-control" href="#similar-product" data-slide="next">
                                        <i class="fa fa-angle-right"></i>
                                      </a>
                                </div>
                                <?}?>
                            </div>
                            <div class="col-sm-7 col-xs-12 shop-detail-item">
                                <div class="product-information"><!--/product-information-->
                                    <h2><?=$arResult['NAME']?></h2>
                                   
                                   
                                <?$minPrice = (isset($arResult['RATIO_PRICE']) ? $arResult['RATIO_PRICE'] : $arResult['MIN_PRICE']);?>
                                    <? $cities = $arResult['PROPERTIES']['CITY_AVAILABLE']['VALUE'];
                                    $codes = Array();
                                    $arSelect = array("ID", "IBLOCK_ID","NAME","CODE");
                                    $arFilter = Array("IBLOCK_ID"=>10, "ID" => $cities);
                                    $res = CIBlockElement::GetList(Array(), $arFilter, false, Array(), $arSelect);
                                    while($ob = $res->GetNextElement()){
                                        $codes[$ob->GetFields()['NAME']] = $ob->GetFields()['CODE'];
                                    }
                                    $exp = explode('.', $_SERVER['SERVER_NAME']);
                                    $city = $exp[0];?>

                                    <?
                                    // echo '<pre>';
                                    // print_r($arResult['MIN_PRICE']['VALUE']);
                                    // echo '</pre>';
                                    ?>

                                    <? //if (((in_array($city, $codes)) or (empty($codes))) and ($arResult['MIN_PRICE']['VALUE'] != 0)){?>
                                        <div class="price-type">
                                            <div class="col-xs-12 price-btn">
                                                <div class="col-xs-6 price-btn"><a id="price_a1" href="javascript:void(0)">Самовывоз с завода</a></div>
                                                <? if ((($arResult['MIN_PRICE']['VALUE'] != 0) or (!empty($arResult['MIN_PRICE']['VALUE']))) and ($arResult['PROPERTIES']['SAMOVYVOZST']['VALUE'] != $arResult['MIN_PRICE']['VALUE'])){?>
                                                <div class="col-xs-6 price-btn"><a id="price_a2" href="javascript:void(0)">Розничная цена</a></div>
                                                <?}?>                          
                                                <input type="hidden" class="type_for_basket">
                                            </div>
                                        </div>
                                        <div class="product-information-price" id="samovyvoz">
                                            <?if ($arResult['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'] > 0){?>
                                                <h2><span>Цена за шт.: </span> <p class="items_old_price"><? echo $arResult['PROPERTIES']['SAMOVYVOZST']['VALUE']; ?><span>руб.</span></p><div id="sam-st"><? echo $arResult['PROPERTIES']['SORT_PRICE']['VALUE']; ?></div> <span>руб.</span></h2>
                                            <?} else {?>
                                                <h2><span>Цена за шт.: </span> <div id="sam-st"><? echo $arResult['PROPERTIES']['SAMOVYVOZST']['VALUE']; ?></div> <span>руб.</span></h2>
                                            <?}?>
                                            <?if ($arResult['PROPERTIES']['SAMOVYVOZM']['VALUE'] != ''){?>
                                                <?if ($arResult['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'] > 0){?>
                                                    <?$new_metr_price = $arResult['PROPERTIES']['SAMOVYVOZM']['VALUE'] - ($arResult['PROPERTIES']['SAMOVYVOZM']['VALUE']/100*$arResult['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'])?>
                                                    <h2><span>Цена за м<sup>2</sup>: <p class="items_old_price"><?=$arResult['PROPERTIES']['SAMOVYVOZM']['VALUE']?><span>руб.</span></p></span> <div id="sam-metr"><? echo $new_metr_price ?></div> <span>руб.</span></h2>
                                                <?} else {?>
                                                    <h2><span>Цена за м<sup>2</sup>: </span> <div id="sam-metr"><?=$arResult['PROPERTIES']['SAMOVYVOZM']['VALUE']?></div> <span>руб.</span></h2>
                                                <?}?>
                                            <?}?>
                                        </div>
                                        <?
                                            $m2roznica = $arResult['MIN_PRICE']['VALUE']/$arResult['PROPERTIES']['SAMOVYVOZST']['VALUE']*$arResult['PROPERTIES']['SAMOVYVOZM']['VALUE'];
                                            $m2roznica = round($m2roznica, 2, PHP_ROUND_HALF_DOWN);
                                        ?>
                                        <? if (($arResult['MIN_PRICE']['VALUE'] != 0) or (!empty($arResult['MIN_PRICE']['VALUE']))){?>
                                            <div class="product-information-price" id="roznica">
                                            <?if ($arResult['MIN_PRICE']['VALUE'] != ''){?>
                                                <?if ($arResult['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'] > 0){?>
                                                    <?$new_roznica_price = $arResult['MIN_PRICE']['VALUE'] - ($arResult['MIN_PRICE']['VALUE']/100*$arResult['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'])?>
                                                    <h2><span>Цена за шт.: </span> <p class="items_old_price"><?=$arResult['MIN_PRICE']['VALUE']?><span>руб.</span></p></span><div id="roznica-st"><?=$new_roznica_price?></div> <span>руб.</span></h2>
                                                <?}else{?>
                                                    <h2><span>Цена за шт.: </span> <div id="roznica-st"><?=$arResult['MIN_PRICE']['VALUE']?></div> <span>руб.</span></h2>
                                                <?}?>
                                            <?}?>
                                            <?if ($m2roznica != ''){?>
                                                <?if ($arResult['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'] > 0){?>
                                                    <?$new_roznicam_price = $m2roznica - ($m2roznica/100*$arResult['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'])?>
                                                    <h2><span>Цена за м<sup>2</sup>: </span> <p class="items_old_price"><?=$m2roznica?><span>руб.</span></p></span><div id="roznica-metr"><?=$new_roznicam_price?></div> <span>руб.</span></h2>
                                                <?} else {?>
                                                    <h2><span>Цена за м<sup>2</sup>: </span> <div id="roznica-metr"><?=$m2roznica?></div> <span>руб.</span></h2>
                                                <?}?>
                                            <?}?>
                                            </div>
                                        <?}?>
                                        <span class="quantity">
                                           
                                            <div id="price-calc"></div><span>руб. </span>
                                            <div class="multiplication">×</div>
                                            <input type="text" class="kol" id="<? echo $arItemIDs['QUANTITY']; ?>" value="<? echo (isset($arResult['OFFERS']) && !empty($arResult['OFFERS'])? 1: $arResult['CATALOG_MEASURE_RATIO']); ?>" />
                                           
                                            <?if (($arResult['PROPERTIES']['SAMOVYVOZM']['VALUE'] != '')and($arResult['MIN_PRICE']['VALUE'] != '')){?>
                                            <select id="kol-type">
                                                <option value="type-one">шт.</option>
                                                <option value="type-two">м2</option>
                                            </select>
                                            <?} else {?>
                                            <select id="kol-type">
                                                <option value="type-one">шт.</option>
                                            </select>
                                            <?}?>
                                            <div class="multiplication">=</div>
                                            <span id="summa">0 руб.</span><span>руб. </span>
                                           
                                        </span>
                                       
                                            <button onclick="add2basket(<?=$arResult['ID']?>)" type="button" class="btn btn-fefault cart detail-cart">
                                                <i class="fa fa-shopping-cart"></i>
                                                Добавить к заказу
                                            </button>
                                            <br>

                                    <?//  } elseif((!in_array($city, $codes)) and (!empty($codes))){?>
                                        <!--</div>
                                        <h3>Нет в наличии в этом городе.</h3>
                                        <span>Есть в
                                            <?foreach ($codes as $key => $value){?>
                                                <?$tmp = '';?>
                                                <?if ($value != 'brick360'){
                                                    $tmp = 'http://'.$value.'.brick360.ru'.$_SERVER['REQUEST_URI'];
                                                } else {
                                                    $tmp = 'http://brick360.ru'.$_SERVER['REQUEST_URI'];
                                                }?>
                                                <a href="<?=$tmp?>"><?=$key?></a>
                                            <?}?>
                                        </span>-->
                                    <? //} else {?>
                                        <!--Не осуществляется доставка данного товара в текущий город.-->
                                    <? //}?>
                                        <?if ($arResult['PROPERTIES']['BRAND']['VALUE'] != '') {?>
                                        <?
                                            $arSelect = Array("ID", "NAME", "PREVIEW_PICTURE","CODE");
                                            $arFilter = Array("IBLOCK_ID"=>6,"ID"=>$arResult['PROPERTIES']['BRAND']['VALUE']);
                                            $res = CIBlockElement::GetList(Array(), $arFilter, false, Array(), $arSelect);
                                            while($ob = $res->GetNextElement())
                                            {
                                             $arFields = $ob->GetFields();?>
                                             <p><img src="<?=CFile::GetPath($arFields['PREVIEW_PICTURE'])?>" class="manufacture-item"> <a href="/proizvoditeli/<?=$arFields['CODE']?>/"><?=$arFields['NAME']?></a></p>
                                             <?}?>
                                        <?}?>
                                   
                                </div><!--/product-information-->
                            </div>
                        </div><!--/product-details-->
                        <div class="category-tab shop-details-tab"><!--category-tab-->
                            <div class="col-sm-12 col-xs-12">
                                <ul class="nav nav-tabs details">
                                    <li class="active"><a href="#details" data-toggle="tab">Описание</a></li>
                                    <li><a href="#current" data-toggle="tab">Характеристики</a></li>
                                    <li><a href="#calculate" data-toggle="tab">Расчет доставки</a></li>
                                </ul>
                            </div>
                            <div class="tab-content">
                                <div class="tab-pane fade active in" id="details" >
                                    <p><?=$arResult['PREVIEW_TEXT']?></p>
                                </div>
                               
                               
                                <div class="tab-pane fade" id="current" >
                                    <table class="about-item">
                                        <?
                                        foreach ($arResult['DISPLAY_PROPERTIES'] as &$arOneProp){?>
                                        <tr>
                                            <?if ($arOneProp['NAME'] != 'Производитель'){?>
                                                <td><? echo $arOneProp['NAME']; ?></td>
                                                <td><? echo $arOneProp['DISPLAY_VALUE']; ?></td>
                                            <?} else {?>
                                                <td><? echo $arOneProp['NAME']; ?></td>
                                                <td><a href="/proizvoditeli/<?=$arOneProp['LINK_ELEMENT_VALUE'][$arOneProp['VALUE']]['CODE']?>/"><?=$arOneProp['LINK_ELEMENT_VALUE'][$arOneProp['VALUE']]['NAME']?></a></td>
                                            <?}?>
                                        </tr>
                                        <?}?>
                                    </table>
                                </div>
                               
                                <div class="tab-pane fade" id="calculate" >
                                    <div class="col-sm-12 col-xs-12">
                                        <p>Для расчета доставки до вашего объекта и необходимого Вам количества товара, нажмите "Расчет доставки". Для расчета доставки до вашего объекта и необходимого Вам количества товара, нажмите "Расчет доставки".</p>
                                        <p><b>Расчет доставки</b></p>
                                       
                                        <form action="#" class="calculate-form">
                                           
                                            <span>
                                                <label>Тип цены</label>
                                                <a href="#" class="price-dostavka active-dostavka">Розничная</a>
                                                <a href="#" class="price-dostavka">Оптовая</a>
                                            </span>
                                            <label>Количество кирпича (шт.)</label>
                                            <input type="text"><br>
                                            <label>Город доставки</label>
                                            <select>
                                                <option>Москва</option>
                                                <option>Калуга</option>
                                                <option>Самара</option>
                                            </select>
                                            <br>
                                            <label>Расстояние (в км)</label>
                                            <input type="text"><br>
                                        </form>
                                        <ul class="dostavka">
                                            <li>
                                                <p>Количество поддонов:</p>
                                                <strong class="sp">1 шт.</strong>
                                            </li>
                                            <li>
                                                <p>Стоимость одного рейса до Москвы:</p>
                                                <strong class="sp">14250 руб.</strong>
                                            </li>
                                            <li>
                                                <p>Количество рейсов:</p>
                                                <strong class="sp">10</strong>
                                            </li>
                                            <li>
                                                <p>Стоимость общей доставки:</p>
                                                <strong class="sp">141250 руб.</strong>
                                            </li>
                                            <li>
                                                <p>Стоимость товара:</p>
                                                <strong class="sp">100 руб.</strong>
                                            </li>
                                            <li>
                                                <p>Итоговая стоимость одной единицы:</p>
                                                <strong class="sp">1000 руб.</strong>
                                            </li>
                                            <li class="summa">
                                                <p>Общая стоимость заказа:</p>
                                                <strong class="main-summa">100000 руб.</strong>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                               
                            </div>
                        </div><!--/category-tab-->
                        <?if ($arResult['PROPERTIES']['ASSOSIATE']['VALUE'] !=''){?>
                        <div class="recommended_items"><!--recommended_items-->
                            <h2 class="title text-center">Сопутствующие товары</h2>
                           
                            <div id="recommended-item-carousel" class="carousel slide" data-ride="carousel">
                                <div class="carousel-inner">
                                    <?$flag_new = 1?>
                                    <?$j = 0?>
                                    <?foreach ($arResult['PROPERTIES']['ASSOSIATE']['VALUE'] as $assosiate_item) {?>
                                    <?if (count($arResult['PROPERTIES']['ASSOSIATE']['VALUE'])>3){?>
                                    <?if ($j == 0){?>
                                        <?if ($flag_new == 1){?>
                                            <div class="item active">
                                            <?$flag_new = 0?>
                                        <?} else {?>
                                            <div class="item">
                                        <?}?>  
                                        <?}?>
                                        <?}?>
                                           
                                            <?
                                            $arSelect = Array('ID','CODE','NAME','PREVIEW_PICTURE','PROPERTY_SAMOVYVOZST','PROPERTY_SAMOVYVOZM','DETAIL_PAGE_URL');
                                            $arFilter = Array("IBLOCK_ID"=>4, "ID"=>$assosiate_item);
                                            $res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>350), $arSelect);
                                            while($ob = $res->GetNextElement())
                                            {
                                             $arFields = $ob->GetFields();
                                            ?>
                                            <div class="col-sm-4">
                                                <div class="product-image-wrapper">
                                                    <div class="single-products">
                                                        <div class="productinfo text-center">
                                                            <a href="<?=$arFields['DETAIL_PAGE_URL']?>"><img src="<?=CFile::GetPath($arFields['PREVIEW_PICTURE'])?>" alt="<?=$arFields['NAME']?>" class="detail-page-img"/></a>
                                                            <div class="price">

                                                                <?if ($arFields['PROPERTY_SAMOVYVOZST_VALUE'] != ''){?>
                                                                    <h2><span>Цена за шт.: </span> <?=$arFields['PROPERTY_SAMOVYVOZST_VALUE']?> <span>руб.</span></h2>
                                                                <?}?>
                                                                <?if ($arFields['PROPERTY_SAMOVYVOZM_VALUE'] != ''){?>
                                                                    <h2><span>Цена за м<sup>2</sup>: </span> <?=$arFields['PROPERTY_SAMOVYVOZM_VALUE']?> <span>руб.</span></h2>
                                                                <?}?>
                                                            </div>
                                                            <a href="<?=$arFields['DETAIL_PAGE_URL']?>" class="product-name"><p><?=$arFields['NAME']?></p></a>
                                                            <a href="<?=$arFields['DETAIL_PAGE_URL']?>" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Сделать заказ</a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <?}?>
                                        <?if (count($arResult['PROPERTIES']['ASSOSIATE']['VALUE']>3)){?>
                                        <?$j++;?>
                                        <?if ($j==3){?>
                                            </div>
                                            <?$j=0?>
                                        <?}?>
                                        <?}?>
                                    <?}?>
                                </div>
                                <?if (count($arResult['PROPERTIES']['ASSOSIATE']['VALUE'])>3){?>
                                     <a class="left recommended-item-control" href="#recommended-item-carousel" data-slide="prev">
                                        <i class="fa fa-angle-left"></i>
                                      </a>
                                      <a class="right recommended-item-control" href="#recommended-item-carousel" data-slide="next">
                                        <i class="fa fa-angle-right"></i>
                                      </a>  
                                  <?}?>      
                            </div>
                        </div><!--/recommended_items-->
                        <?}?>
                        <?if ($arResult['PROPERTIES']['ANALOG']['VALUE'] != ''){?>
                        <div class="recommended_items"><!--recommended_items-->
                            <h2 class="title text-center">Аналогичные товары</h2>
                           
                            <div id="recommended-item-carousel" class="carousel slide" data-ride="carousel">
                                <div class="carousel-inner">
                                    <?$flag_new = 1?>
                                    <?$j = 0?>
                                    <?foreach ($arResult['PROPERTIES']['ANALOG']['VALUE'] as $analog_item) {?>
                                    <?if (count($arResult['PROPERTIES']['ANALOG']['VALUE'])>3){?>
                                    <?if ($j == 0){?>
                                        <?if ($flag_new == 1){?>
                                            <div class="item active">
                                            <?$flag_new = 0?>
                                        <?} else {?>
                                            <div class="item">
                                        <?}?>  
                                        <?}?>
                                        <?}?>
                                           
                                            <?
                                            $arSelect = Array('ID','CODE','NAME','PREVIEW_PICTURE','PROPERTY_SAMOVYVOZST','PROPERTY_SAMOVYVOZM', 'PROPERTY_NEW', 'PROPERTY_HIT', 'PROPERTY_SALE','DETAIL_PAGE_URL');
                                            $arFilter = Array("IBLOCK_ID"=>4, "ID"=>$analog_item);
                                            $res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>350), $arSelect);
                                            while($ob = $res->GetNextElement())
                                            {
                                             $arFields = $ob->GetFields();
                                            ?>
                                            <div class="col-sm-4">
                                                <div class="product-image-wrapper">
                                                    <div class="single-products">
                                                        <div class="productinfo text-center">
                                                            <a href="<?=$arFields['DETAIL_PAGE_URL']?>"><img src="<?=CFile::GetPath($arFields['PREVIEW_PICTURE'])?>" alt="<?=$arFields['NAME']?>" class="detail-page-img"/></a>
                                                            <div class="price">
                                                                <?if ($arFields['PROPERTY_SAMOVYVOZST_VALUE'] != ''){?>
                                                                    <h2><span>Цена за шт.: </span> <?=$arFields['PROPERTY_SAMOVYVOZST_VALUE']?> <span>руб.</span></h2>
                                                                <?}?>
                                                                <?if ($arFields['PROPERTY_SAMOVYVOZM_VALUE'] != ''){?>
                                                                    <h2><span>Цена за м<sup>2</sup>: </span> <?=$arFields['PROPERTY_SAMOVYVOZM_VALUE']?> <span>руб.</span></h2>
                                                                <?}?>
                                                            </div>
                                                            <a href="<?=$arFields['DETAIL_PAGE_URL']?>" class="product-name"><p><?=$arFields['NAME']?></p></a>
                                                            <a href="<?=$arFields['DETAIL_PAGE_URL']?>" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Сделать заказ</a>
                                                        </div>
                                                        <?if (!empty($arFields['PROPERTIES_SALE_VALUE'])){?>
                                                            <img src="/bitrix/templates/main/images/home/sale.png" class="new" alt="Распродажа - <?=$arElement["NAME"]?>">
                                                        <?} elseif (!empty($arFields['PROPERTIES_HIT_VALUE'])){?>
                                                            <img src="/bitrix/templates/main/images/home/hit.png" class="new" alt="Хит продаж - <?=$arElement["NAME"]?>">
                                                        <?} elseif (!empty($arFields['PROPERTIES_NEW_VALUE'])){?>
                                                            <img src="/bitrix/templates/main/images/home/new.png" class="new" alt="Новинка - <?=$arElement["NAME"]?>">
                                                        <?}?>
                                                    </div>
                                                </div>
                                            </div>
                                            <?}?>
                                        <?if (count($arResult['PROPERTIES']['ANALOG']['VALUE']>3)){?>
                                        <?$j++;?>
                                        <?if ($j==3){?>
                                            </div>
                                            <?$j=0?>
                                        <?}?>
                                        <?}?>
                                    <?}?>
                                </div>
                                <?if (count($arResult['PROPERTIES']['ANALOG']['VALUE'])>3){?>
                                     <a class="left recommended-item-control" href="#recommended-item-carousel" data-slide="prev">
                                        <i class="fa fa-angle-left"></i>
                                      </a>
                                      <a class="right recommended-item-control" href="#recommended-item-carousel" data-slide="next">
                                        <i class="fa fa-angle-right"></i>
                                      </a>  
                                  <?}?>      
                            </div>
                        </div><!--/recommended_items-->
                        </div><!--/recommended_items-->
                        <?}?>




    <div class="modal fade" id="<?=$arResult['ID']?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog in_basket">
        <div class="modal-content">
          <div class="modal-body">
              <div class="title_on_basket" style="font-size: 22px;">Товар добавлен к заказу</div>
            <div class="tovar_on_basket"><img src="<?=$arResult["PREVIEW_PICTURE"]['SRC']?>"></div>
            <div class="title_on_basket"><?=$arResult['NAME']?></div>
          </div>
          <div class="modal-footer-in-basket">
              <div class="title_on_basket_new">Вы можете</div>
            <button type="button" class="btn btn-default to_order" data-dismiss="modal">Продолжить покупки</button>
            <div class="title_on_basket_new">или</div>
            <a href="/personal/cart/" class="btn btn-primary to_order">Перейти к оформлению заказа</a>
          </div>
        </div>
      </div>
    </div>

    <script type="text/javascript">
    function add2basket(ID) {

        var type_price = '';
        var quant = 0;
        var theClass1 = $('#price_a2').attr('class');
        var theClass2 = $('#price_a1').attr('class');
        var type = $("#kol-type").val();
        var price = $("input.type_for_basket").val();
        if (theClass1 == 'active-price'){
            type_price = 'roznica';
            if (type == 'type-one'){
                quant = $("input.kol").val();
            }
            if (type == 'type-two'){
                quant = Math.ceil(($('#roznica-metr').text() * $("input.kol").val())/$('#roznica-st').text());
            }
        } else {
            type_price = 'samovyvoz';
            if (type == 'type-one'){
                quant = $("input.kol").val();
            }
            if (type == 'type-two'){
                quant = Math.ceil(($('#sam-metr').text() * $("input.kol").val())/$('#sam-st').text());
            }
        }
       
        $.ajax({
            type: "POST",
            url: "/ajax/add2basket_ajax.php",
            data: {
                ID: ID,
                QUANTITY: quant,
                TYPE_PRICE: type_price,
            },

            success: function(msg){
                BX.onCustomEvent('OnBasketChange');
                //alert('#'+$.trim(msg));
                $('#'+$.trim(msg)).modal();

            }
        });
    }

    var <? echo $strObName; ?> = new JCCatalogElement(<? echo CUtil::PhpToJSObject($arJSParams, false, true); ?>);
    BX.message({
        ECONOMY_INFO_MESSAGE: '<? echo GetMessageJS('CT_BCE_CATALOG_ECONOMY_INFO'); ?>',
        BASIS_PRICE_MESSAGE: '<? echo GetMessageJS('CT_BCE_CATALOG_MESS_BASIS_PRICE') ?>',
        TITLE_ERROR: '<? echo GetMessageJS('CT_BCE_CATALOG_TITLE_ERROR') ?>',
        TITLE_BASKET_PROPS: '<? echo GetMessageJS('CT_BCE_CATALOG_TITLE_BASKET_PROPS') ?>',
        BASKET_UNKNOWN_ERROR: '<? echo GetMessageJS('CT_BCE_CATALOG_BASKET_UNKNOWN_ERROR') ?>',
        BTN_SEND_PROPS: '<? echo GetMessageJS('CT_BCE_CATALOG_BTN_SEND_PROPS'); ?>',
        BTN_MESSAGE_BASKET_REDIRECT: '<? echo GetMessageJS('CT_BCE_CATALOG_BTN_MESSAGE_BASKET_REDIRECT') ?>',
        BTN_MESSAGE_CLOSE: '<? echo GetMessageJS('CT_BCE_CATALOG_BTN_MESSAGE_CLOSE'); ?>',
        BTN_MESSAGE_CLOSE_POPUP: '<? echo GetMessageJS('CT_BCE_CATALOG_BTN_MESSAGE_CLOSE_POPUP'); ?>',
        TITLE_SUCCESSFUL: '<? echo GetMessageJS('CT_BCE_CATALOG_ADD_TO_BASKET_OK'); ?>',
        COMPARE_MESSAGE_OK: '<? echo GetMessageJS('CT_BCE_CATALOG_MESS_COMPARE_OK') ?>',
        COMPARE_UNKNOWN_ERROR: '<? echo GetMessageJS('CT_BCE_CATALOG_MESS_COMPARE_UNKNOWN_ERROR') ?>',
        COMPARE_TITLE: '<? echo GetMessageJS('CT_BCE_CATALOG_MESS_COMPARE_TITLE') ?>',
        BTN_MESSAGE_COMPARE_REDIRECT: '<? echo GetMessageJS('CT_BCE_CATALOG_BTN_MESSAGE_COMPARE_REDIRECT') ?>',
        PRODUCT_GIFT_LABEL: '<? echo GetMessageJS('CT_BCE_CATALOG_PRODUCT_GIFT_LABEL') ?>',
        SITE_ID: '<? echo SITE_ID; ?>'
    });
    </script>