Renderlife
4/10/2019 - 7:02 AM

Доставка в детальной каталога Битрикс

Доставка в детальной каталога Битрикс

<?php

use \Bitrix\Main\Localization\Loc,
    \Bitrix\Main\Web\Json;

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED!==true)die();

$this->setFrameMode(true);

if (!function_exists('getStringCatalogStoreAmountEx')){
    function getStringCatalogStoreAmountEx($amount, $minAmount, $arReturn){
        $message = $arReturn[1];
        if (intval($amount) == 0){
            $message = $arReturn[0];
        } elseif (intval($amount) >= $minAmount){
            $message = $arReturn[2];
        }
        return $message;
    }
}

$arPropsHide = array();
$bHaveOffer = false;
if (empty($arResult['OFFERS'])) {
    $arItemShow = &$arResult;
} else {
    $bHaveOffer = true;
    if (!$arResult['OFFERS_SELECTED']) {
        $arResult['OFFERS_SELECTED'] = 0;
    }
    $arItemShow = &$arResult['OFFERS'][$arResult['OFFERS_SELECTED']];
}
;
$arItemShowPrice = array();
if ($arParams['USE_PRICE_COUNT']) {

    foreach ($arItemShow['PRICE_MATRIX']['COLS'] as $typeID => $arType) {
        if ($arItemShow['PRICE_MATRIX']['MATRIX'][$typeID][0]['MIN_PRICE'] != 'Y') {
            continue;
        }
        $arItemShowPrice = $arItemShow['PRICE_MATRIX']['MATRIX'][$typeID][0];
        $arItemShowPrice['PRICE_ID'] = $arType['ID'];
        $arItemShowPrice['DISCOUNT_VALUE'] = $arItemShowPrice['DISCOUNT_PRICE'];
        break;
    }
} else {
    foreach ($arItemShow['PRICES'] as $arPrice) {
        if ($arPrice['MIN_PRICE'] != 'Y') {
            continue;
        }
        $arItemShowPrice = $arPrice;
        break;
    }
}

$arSKU = array();

$delivery_info['product_id'] = $arResult['ID'];
$delivery_info['product_name'] = $arResult['NAME'];
$delivery_info['product_price'] = $arResult['OFFERS'][0]['MIN_PRICE']['VALUE_NOVAT'];
$delivery_info['weight'] = $arResult['PROPERTIES']['VES_GRAMM']['VALUE'];
$delivery_info['width'] = $arResult['PROPERTIES']['SHIRINA_UPAKOVKI_MM']['VALUE'];
$delivery_info['height'] = $arResult['PROPERTIES']['TOLSHCHINA_UPAKOVKI_MM']['VALUE'];
$delivery_info['length'] = $arResult['PROPERTIES']['DLINA_UPAKOVKI_MM']['VALUE'];

$del_test = $arResult;

if (0 && $_REQUEST['test'] == 'Y' && $USER->IsAdmin()) {
    $eee = \Bitrix\Sale\Delivery\Services\Manager::getService(20);


    $ar_dtype = \Bitrix\Sale\Delivery\Services\Manager::getActiveList();
    foreach ($ar_dtype as $key => $value) {
        $deliveryIds[] = [
            'ID' => $value['ID'],
            'NAME' => $value['NAME'] . ' (id=' . $value['ID'] . ')',
        ];
    }

    $citiId = '';
    $res = \Bitrix\Sale\Location\LocationTable::getList(array(
        'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID),
        'select' => array('*', 'NAME_RU' => 'NAME.NAME', 'TYPE_CODE' => 'TYPE.CODE')
    ));
    while ($item = $res->fetch()) {
        if ($item['NAME_RU'] == $_SESSION['city']) {
            $citiId = $item['CITY_ID'];
        }
    }


    $products = array(
        /*0 => array(
            'QUANTITY' => 1,
            'WEIGHT' => '116.00',
            //'PRICE' => '2802.5000',
            'PRICE' => '2950.0000',
            'BASE_PRICE' => '2950.0000',
            'DIMENSIONS' => array(
                'WIDTH' => '50',
                'HEIGHT' => '270',
                'LENGTH' => '50',
            ),
        ),*/
        0 => array(
            'MODULE' => 'catalog',
            'PRODUCT_ID' => '53261',
            'ID' => '20958',
            'LID' => 's1',
            'QUANTITY' => 1,
            'WEIGHT' => '116.00',
            'DELAY' => 'N',
            'CAN_BUY' => 'Y',
            'PRICE' => '2802.5000',
            'CUSTOM_PRICE' => 'N',
            'BASE_PRICE' => '2950.0000',
            'PRODUCT_PRICE_ID' => '30558',
            'PRICE_TYPE_ID' => '1',
            'CURRENCY' => 'RUB',
            'BARCODE_MULTI' => 'N',
            'RESERVED' => 'N',
            'RESERVE_QUANTITY' => NULL,
            'NAME' => 'Нож "Универсал" (дамаск)',
            'CATALOG_XML_ID' => '57f61189-88b0-4bfb-8fd8-5ad3fa41739b#',
            'VAT_RATE' => '0.0000',
            'NOTES' => 'Цена',
            'DISCOUNT_PRICE' => '147.5000',
            'PRODUCT_PROVIDER_CLASS' => '\\Bitrix\\Catalog\\Product\\CatalogProvider',
            'CALLBACK_FUNC' => NULL,
            'ORDER_CALLBACK_FUNC' => NULL,
            'PAY_CALLBACK_FUNC' => NULL,
            'CANCEL_CALLBACK_FUNC' => NULL,
            'DIMENSIONS' => array(
                'WIDTH' => '50',
                'HEIGHT' => '270',
                'LENGTH' => '50',
            ),
            'TYPE' => NULL,
            'SET_PARENT_ID' => NULL,
            'DETAIL_PAGE_URL' => '/catalog/okhotnichi_i_turisticheskie_nozhi/nozh_universal_damask/',
            'FUSER_ID' => '9924914',
            'MEASURE_CODE' => '796',
            'MEASURE_NAME' => 'шт',
            'ORDER_ID' => NULL,
            'PRODUCT_XML_ID' => '6399c2bf-581e-11e3-8f6d-089e018d9d70#6399c2bf-581e-11e3-8f6d-089e018d9d70',
            'SUBSCRIBE' => 'N',
            'RECOMMENDATION' => NULL,
            'VAT_INCLUDED' => 'Y',
            'SORT' => '100',
            'DATE_REFRESH' => NULL,
            'DISCOUNT_NAME' => '[69] скидка 5%',
            'DISCOUNT_VALUE' => '5%',
            'DISCOUNT_COUPON' => NULL,
        ),
    );

    $sender = '2669';
    $dataPost = array(
        'ITEMS' => $products,

        'SENDER' => $sender,
        'ACCOUNT' => '1',
        'LOCATION_TO' => '2624', // Новосибирск
        //'LOCATION_TO' => '2545', // Чита

        'PRICE' => 2802.5,
        'WEIGHT' => 116,

        'SITE_ID' => 's1',
        'PERSON_TYPE_ID' => 1,
        'CURRENCY' => 'RUB',

        /*'LOCATION_FROM' => '0000965067',
        'LOCATION_TO' => '0000919483',
        'LOCATION_ZIP' => '',*/



    );

    $APPLICATION->IncludeComponent("bitrix:sale.ajax.delivery.calculator","", array(
        "NO_AJAX" => 'Y',
        "DELIVERY_ID" => 20,
        "PROFILE" => '27',
        "ORDER_WEIGHT" => "",
        "ORDER_PRICE" => $delivery_info['product_price'],
        "LOCATION_TO" => $citiId,
        "CURRENCY" => "RUB",
        //"DELIVERY" => 'new20',
        'ITEMS' => $products,

    ));

    /*foreach ($deliveryIds as $key => $deliv) {
        print_r("<h3>{$deliv['NAME']}</h3></br>");
        //print_r($deliv['ID']);
        $APPLICATION->IncludeComponent('bitrix:sale.ajax.delivery.calculator', '', array(
            "NO_AJAX" => 'N',
            "DELIVERY_ID" => $deliv['ID'],
            "PROFILE" => "12",
            "ORDER_WEIGHT" => "",
            "ORDER_PRICE" => $delivery_info['product_price'],
            "LOCATION_TO" => $citiId,
            "CURRENCY" => "RUB",
        ));
        print_r("</br>");
    }*/

    print_r('<pre>');
    print_r($delivery_info);
    print_r('</pre>');

    die;



    $deliveryId = 27;

    // Массив товаров
    $arItems = array(
        array(
            'PRODUCT_ID' => $delivery_info['product_id'],
            'NAME' => $delivery_info['product_name'],
            'PRICE' => $delivery_info['product_price'],
            'CURRENCY' => 'RUB',
            'QUANTITY' => 1
        )
    );

    // Создаем и наполняем корзину
    $basket = \Bitrix\Sale\Basket::create(SITE_ID);
    foreach ($arItems as $i => $arItem) {
        $basketItem = $basket->createItem("catalog", $arItem['PRODUCT_ID']);
        $basketItem->setFields($arItem);
    }

    // Создаем заказ и привязываем корзину, перерасчет происходит автоматически
    $order = \Bitrix\Sale\Order::create(SITE_ID, $userId);
    $order->setPersonTypeId($personTypeId);
    $order->setBasket($basket);

    // Создание отгрузки
    $shipmentCollection = $order->getShipmentCollection();
    $shipment = $shipmentCollection->createItem(
        \Bitrix\Sale\Delivery\Services\Manager::getObjectById(27)
    );
    $shipmentItemCollection = $shipment->getShipmentItemCollection();

    $arDelivery = \Bitrix\Sale\Delivery\Services\Manager::calculateDeliveryPrice($shipment, 27, array());
    $del_pr['period'] = $arDelivery->getPeriodDescription();
    $del_pr['price'] = $arDelivery->getDeliveryPrice();
    $del_pr['desc'] = $arDelivery->getDescription();
    $del_pr['price2'] = $arDelivery->getPrice();
    $del_pr['tmp'] = $arDelivery->getTmpData();

    print_r('<pre>');
    print_r($del_pr);
    print_r('</pre>');

}

if (0 && $_REQUEST['test'] == 'Y' && $USER->IsAdmin()) {

$deliveryId = 20;
$obBasket = \Bitrix\Sale\Basket::create(SITE_ID);
$obItem = $obBasket->createItem("catalog", $delivery_info['product_id']);
$arProductFields = array(
    'NAME' => $delivery_info['product_name'],
    //'PRICE' => $delivery_info['product_price'],
    'CURRENCY' => 'RUB',
    'QUANTITY' => 1,
    'LID' => \Bitrix\Main\Context::getCurrent()->getSite(),
    'PRODUCT_PROVIDER_CLASS' => 'CCatalogProductProvider',
    'WEIGHT' => $delivery_info['weight'] . '.00',
    'PRICE' => $delivery_info['product_price'] . '.0000',
    'BASE_PRICE' => $delivery_info['product_price'] . '.0000',
    'DIMENSIONS' => array(
        'WIDTH' => $delivery_info['weight'],
        'HEIGHT' => $delivery_info['height'],
        'LENGTH' => $delivery_info['length'],
    ),
);
$obItem->setFields($arProductFields);

$obOrder = \Bitrix\Sale\Order::create(SITE_ID, 1);
$obOrder->setPersonTypeId(1);
$obOrder->setBasket($obBasket);
$obShipmentCollection = $obOrder->getShipmentCollection();
$obShipment = $obShipmentCollection->createItem(\Bitrix\Sale\Delivery\Services\Manager::getObjectById($deliveryId));

/*$shipmentItemCollection = $obShipment->getShipmentItemCollection();
$obShipment->setField('CURRENCY', $this->order->getCurrency());

foreach ($this->order->getBasket()->getOrderableItems() as $item) {
    $shipmentItem = $shipmentItemCollection->createItem($item);
    $shipmentItem->setQuantity($item->getQuantity());
}*/


$obShipment->setField('DELIVERY_ID', $deliveryId);
$obShipment->setField('DELIVERY_NAME', 'Посылка');

print_r('<pre>');
//print_r($obShipment);
print_r('</pre>');

$arDelivery = \Bitrix\Sale\Delivery\Services\Manager::calculateDeliveryPrice($obShipment, 20, array());
$del_pr['period'] = $arDelivery->getPeriodDescription();
$del_pr['price'] = $arDelivery->getDeliveryPrice();
$del_pr['desc'] = $arDelivery->getDescription();
$del_pr['price2'] = $arDelivery->getPrice();
$del_pr['tmp'] = $arDelivery->getTmpData();

print_r('<pre>');
print_r($arDelivery);
print_r($del_pr);
print_r('</pre>');

}

if (1 || $_REQUEST['test'] == 'Y' && $USER->IsAdmin()) {
    $ar_dtype = \Bitrix\Sale\Delivery\Services\Manager::getActiveList();
    foreach ($ar_dtype as $key => $value) {
        $deliveryIds[] = [
            'ID' => $value['ID'],
            'NAME' => $value['NAME'] . ' (id=' . $value['ID'] . ')',
        ];
    }

    $citiId = '';
    $res = \Bitrix\Sale\Location\LocationTable::getList(array(
        'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID),
        'select' => array('*', 'NAME_RU' => 'NAME.NAME', 'TYPE_CODE' => 'TYPE.CODE')
    ));
    while ($item = $res->fetch()) {
        if ($item['NAME_RU'] == $_SESSION['city']) {
            $citiId = $item['CITY_ID'];
        }
    }

    /*if ($USER->IsAdmin()) {
        print_r($delivery_info);
        print_r($citiId);
    }*/

    $products = array(
        0 => array(
            'QUANTITY' => 1,
            'WEIGHT' => $delivery_info['weight'] . '.00',
            'PRICE' => $delivery_info['product_price'] . '.0000',
            'BASE_PRICE' => $delivery_info['product_price'] . '.0000',
            'DIMENSIONS' => array(
                'WIDTH' => $delivery_info['weight'],
                'HEIGHT' => $delivery_info['height'],
                'LENGTH' => $delivery_info['length'],
            ),
        ),
    );

    $sender = '268';
    $data = array(
        'RECEIVER' => sqlSdekCity::getByBId($citiId)['SDEK_ID'],
        'ITEMS' => $products,
        'SENDER' => $sender,
        'ACCOUNT' => '1',
    );

    $sdekShipments = new sdekShipment($data);
    $sdekShipments->calcProfile('courier');
    $sdekShipments->calcProfile('pickup');

    CModule::IncludeModule('sale');

    $deliveryObj = \Bitrix\Sale\Delivery\Services\Manager::getObjectById(9);
    $arraySetting = $deliveryObj->getConfig()['MAIN']['ITEMS'];
    $margin = 0;
    $marginType = '%';

    foreach ($arraySetting as $key => $value) {
        if ($value['NAME'] == 'Наценка') {
            $margin = $value['VALUE'];
        }
        if ($value['NAME'] == 'Тип наценки') {
            $marginType = $value['VALUE'];
        }

    }

    $deliveryObj = \Bitrix\Sale\Delivery\Services\Manager::getObjectById(8);
    $arraySettingParent = $deliveryObj->getConfig()['MAIN']['ITEMS'];
    $marginParent = 0;
    $marginTypeParent = 'CURRENCY';

    foreach ($arraySettingParent as $key => $value) {
        if ($value['NAME'] == 'Наценка') {
            $marginParent = $value['VALUE'];
        }
        if ($value['NAME'] == 'Тип наценки') {
            $marginTypeParent = $value['VALUE'];
        }
    }

    $deliveryObj = \Bitrix\Sale\Delivery\Services\Manager::getObjectById(10);
    $arraySettingSam = $deliveryObj->getConfig()['MAIN']['ITEMS'];
    $marginSam = 0;
    $marginTypeSam = '%';

    foreach ($arraySettingSam as $key => $value) {
        if ($value['NAME'] == 'Наценка') {
            $marginSam = $value['VALUE'];
        }
        if ($value['NAME'] == 'Тип наценки') {
            $marginSam = $value['VALUE'];
        }
    }

    $arShipment = [];

    foreach ($sdekShipments->getProfiles() as $key => $sdekShipment) {
        $period = '-';

        if (!empty($sdekShipment['TERMSBAZE'])) {
            if (isset($sdekShipment['TERMSBAZE']['MIN']) && isset($sdekShipment['TERMSBAZE']['MAX'])) {
                $period = $sdekShipment['TERMSBAZE']['MIN'] . '-' . $sdekShipment['TERMSBAZE']['MAX'] . ' дня(й)';
            }
        }

        $price = '-';
        //$price = $sdekShipment['PRICE'];

        if (!empty($sdekShipment['PRICE']) && !empty($marginParent)) {
            if ($marginTypeParent == '%') {
                $marginParent = 1 + ($marginParent / 100);
                $price = $sdekShipment['PRICE'] * $marginParent;
            } else {
                $price = $sdekShipment['PRICE'] + $marginParent;
            }
        }

        if (!empty($price) && $price !== '-') {
            $sdekShipment['PRICE'] = $price;
        }

        if ($key == 'courier') {
            $name = 'Курьерская<br />компания «СДЭК»';

            if (!empty($sdekShipment['PRICE']) && !empty($margin)) {
                if ($marginType == '%') {
                    $marginTemp = ($margin / 100) + 1;
                    $price = $sdekShipment['PRICE'] * $marginTemp;
                } else {
                    $price = $sdekShipment['PRICE'] + $marginTemp;
                }
            }
        } else {
            $name = 'Самовывоз<br />компания «СДЭК»';

            if (!empty($sdekShipment['PRICE']) && !empty($marginSam)) {
                if ($marginTypeSam == '%') {
                    $marginTemp = ($marginSam / 100) + 1;
                    $price = $sdekShipment['PRICE'] * $marginTemp;
                } else {
                    $price = $sdekShipment['PRICE'] + $marginTemp;
                }
            }
        }

        $arShipment[$key] = [
            'name' => $name,
            'price' => round($price) . ' р.',
            'period' => $period,
        ];
    }

    // Почта-России - наземный транспорт

    $sender = '2669'; // Омск
    $dataPost = array(
        'ITEMS' => $products,
        'SENDER' => $sender,
        'ACCOUNT' => '1',
        'LOCATION_TO' => $citiId,
    );

    /*$dataPost = array(
        'RECEIVER' => '3139',
        'ITEMS' => $products,
        'SENDER' => '',
        'ACCOUNT' => '1',
        'LOCATION_TO' => '3139',
        "NO_AJAX" => 'N',
        "DELIVERY_ID" => 5,
        "PROFILE" => "land",
        "ORDER_WEIGHT" => "10000",
        "ORDER_PRICE" => '10000',
        "CURRENCY" => "RUB",
    );

    array (
    'zones' => 'Почтовые зоны',
    'tarifs' => 'Общие тарифы',
    'land' => 'Наземная доставка',
    'avia' => 'Авиа доставка',
    ),


    */

    $profiles = array('land', 'avia');
    $postShipments = new \CDeliveryRusPost;
    $conf = $postShipments->GetConfig(SITE_ID)['CONFIG'];
    $postShipmentsPrice[$profiles[0]] = $postShipments->Calculate($profiles[0], $conf, $dataPost);
}



$brand = str_replace(array("\"","'"), '', $arResult['PROPERTIES']['BREND']['VALUE']);

if($arResult['IBLOCK_SECTION_ID']){

    $rsSect = CIBlockSection::GetList(array(), array('ID' =>$arResult['IBLOCK_SECTION_ID']), false, array('ID', 'NAME'));
    if($arSect = $rsSect->GetNext())
    {
       $category =  str_replace(array("\"","'"), '', $arSect['NAME']);
    }

}

if($arResult['OFFERS']){
    $countOffer = count($arResult['OFFERS']);
    $counter = 0; ?>
        <script type="text/javascript">
                dataLayer.push({
                "ecommerce": {
                    "detail": {
                        "products": [
                            <?
                            foreach($arResult['OFFERS'] as $offer){
                                $counter++;
                            ?>
                            {
                                "id": "<?=$offer['ID']?>",
                                "name" : "<?=str_replace(array("\"","'"), '', $offer['NAME']); ?>",
                                <?if($brand):?>
                                "brand": "<?=$brand?>",
                                <?endif?>
                                <?if($category):?>
                                "category": "<?=$category?>",
                                <?endif?>
                                "price": <?=$offer["MIN_PRICE"]["DISCOUNT_VALUE"]?>

                            }<?if($counter < $countOffer){?>,<?}?>
                            <?}?>

                        ]
                    }
                }
            });
        </script>
        <?
}else{
    ?>
    <script type="text/javascript">
            dataLayer.push({
            "ecommerce": {
                "detail": {
                    "products": [
                        {

                            "id": "<?=$arResult['ID']?>",
                            "name" : "<?=str_replace(array("\"","'"), '', $arResult['NAME']); ?>",
                            <?if($brand):?>
                            "brand": "<?=$brand?>",
                            <?endif?>
                            <?if($category):?>
                            "category": "<?=$category?>",
                            <?endif?>
                            "price": <?=$arResult["MIN_PRICE"]["DISCOUNT_VALUE"]?>

                        },

                    ]
                }
            }
        });
    </script>
    <?
}


ob_start();
?>
<div class="detail row" itemscope itemtype="http://schema.org/Product">
<div class="col-xs-12">
<?php
$strEdit = CIBlock::GetArrayByID($arParams['IBLOCK_ID'], 'ELEMENT_EDIT');
$strDelete = CIBlock::GetArrayByID($arParams['IBLOCK_ID'], 'ELEMENT_DELETE');
$arDeleteParams = array('CONFIRM' => Loc::getMessage('RS_SLINE.BCE_CATALOG.ELEMENT_DELETE_CONFIRM'));

$this->AddEditAction($arResult['ID'], $arResult['EDIT_LINK'], $strEdit);
$this->AddDeleteAction($arResult['ID'], $arResult['DELETE_LINK'], $strDelete, $arDeleteParams);
$strMainID = $this->GetEditAreaId($arResult['ID']);
$sItemClass = 'detail__product product js-product row clearfix';
if (isset($arResult['DAYSARTICLE2']) || isset($arItemShow['DAYSARTICLE2'])) {
    $sItemClass .= ' da';
}
if (isset($arResult['QUICKBUY']) || isset($arItemShow['QUICKBUY'])) {
    $sItemClass .= ' qb';
}
?>
<div class="<?=$sItemClass?>"
    data-brand="<?=$brand?>"
    data-category="<?=$category?>"
    id="<?=$strMainID?>"
    data-product-id="<?=$arResult['ID']?>"
    <?php if ($bHaveOffer): ?>data-offer-id="<?=$arItemShow['ID']?>"<?php endif; ?>
    data-detail="<?=$arResult['DETAIL_PAGE_URL']?>"
>
    <div class="detail__head-container col-xs-12 col-sm-12">

        <?php
        $sBrandPropCode = $arParams['BRAND_PROP'][$arResult['IBLOCK_ID']];

        if (!empty($arResult['PROPERTIES'][$sBrandPropCode]['VALUE'])):
        ?>
        <div class="detail__brand">
          <?php
          if (is_array($arResult['PROPERTIES'][$sBrandPropCode]['VALUE'])):
              echo implode(' / ', array_map(
                  function($sName, $sLink) {
                      return '<a href="' . $sLink . '">' . $sName . '</a>';
                  },
                  $arResult['PROPERTIES'][$sBrandPropCode]['VALUE'],
                  $arResult['PROPERTIES'][$sBrandPropCode]['FILTER_URL']
              ));
          else: ?>
            <a href="<?=$arResult['PROPERTIES'][$sBrandPropCode]['FILTER_URL']?>">
                <?php if (isset($arResult['PROPERTIES'][$sBrandPropCode]['PICT'])): ?>
                    <img src="<?=$arResult['PROPERTIES'][$sBrandPropCode]['PICT']['SRC']?>" alt="<?=$arResult['PROPERTIES'][$sBrandPropCode]['ALT']?>">
                <?php elseif (isset($arResult['PROPERTIES'][$arParams['BRAND_LOGO_PROP'][$arResult['IBLOCK']]]['PICT'])): ?>
                    <img src="<?=$arResult['PROPERTIES'][$arParams['BRAND_LOGO_PROP'][$arResult['IBLOCK']]]['PICT']['SRC']?>" alt="<?=$arResult['PROPERTIES'][$sBrandPropCode]['VALUE']?>">
                <?php
                else:
                    if (isset($arResult['DISPLAY_PROPERTIES'][$sBrandPropCode]['DISPLAY_VALUE'])) {
                        echo $arResult['DISPLAY_PROPERTIES'][$sBrandPropCode]['DISPLAY_VALUE'];
                    } else {
                        echo $arResult['PROPERTIES'][$sBrandPropCode]['VALUE'];
                    }
                endif;
                ?>
            </a>
        <?php endif; ?>
        </div>
        <?php endif; ?>
        <div class="catalog__head">
          <?
          $GLOBALS['ID_PR'] = $arResult['ID'];
          ?>
            <h1 itemprop="name" class="detail__name webpage__title js-product__name">
                <?php
                echo (isset($arResult["IPROPERTY_VALUES"]["ELEMENT_PAGE_TITLE"]) && $arResult["IPROPERTY_VALUES"]["ELEMENT_PAGE_TITLE"] != ''
                ? $arResult["IPROPERTY_VALUES"]["ELEMENT_PAGE_TITLE"]
                : $arResult["NAME"]);
                ?>
            </h1>
            <?php if ($arParams['USE_LIKES'] == 'Y'): ?>
                <span class="detail__favorite favorite js-favorite">
                    <svg class="favorite__icon icon icon-heart icon-svg"><use xlink:href="#svg-heart"></use></svg>
                    <span class="favorite__cnt">
                        <?php
                        if (intval($arResult['PROPERTIES'][$arParams['LIKES_COUNT_PROP']]['VALUE']) > 0) {
                            echo $arResult['PROPERTIES'][$arParams['LIKES_COUNT_PROP']]['VALUE'];
                        }
                        ?>
                    </span>
                </span>
            <?php endif; ?>

            <div class="product__article">
                <?php
                if (
                    isset($arItemShow['PROPERTIES'][$arParams['ARTICLE_PROP'][$arItemShow['IBLOCK_ID']]]) &&
                    $arItemShow['PROPERTIES'][$arParams['ARTICLE_PROP'][$arItemShow['IBLOCK_ID']]]['VALUE'] != ''
                ):
                ?>
                    <span class="sku_prop__name"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.ITEM_ARTICLE')?>:</span>
                    <span class="sku_prop__val_<?=$arItemShow['PROPERTIES'][$arParams['ARTICLE_PROP'][$arItemShow['IBLOCK_ID']]]['ID']?>"><?=$arItemShow['PROPERTIES'][$arParams['ARTICLE_PROP'][$arItemShow['IBLOCK_ID']]]['VALUE']?></span>
                <?php
                elseif (
                    isset($arResult['PROPERTIES'][$arParams['ARTICLE_PROP'][$arResult['IBLOCK_ID']]]) &&
                    $arResult['PROPERTIES'][$arParams['ARTICLE_PROP'][$arResult['IBLOCK_ID']]]['VALUE'] != ''
                ):
                ?>
                    <?=Loc::getMessage('RS_SLINE.BCE_CATALOG.ITEM_ARTICLE')?>:
                    <span class="js_product-article"><?=$arResult['PROPERTIES'][$arParams['ARTICLE_PROP'][$arResult['IBLOCK_ID']]]['VALUE']?></span>
                <?php
                endif;
                ?>
            </div>
        </div>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
        <div class="detail__picbox picbox">
            <div class="picbox__pic">
                <div class="picbox__frame glass">
                    <div class="picbox__carousel">
                    <?php
                        $sDetailPictureClass = 'picbox__canvas';
                        if ($arParams['USE_PICTURE_ZOOM'] == 'Y'){
                            $sDetailPictureClass .= ' js_picture_glass';
                        }
                        if ($arParams['USE_PICTURE_GALLERY'] == 'Y'){
                            $sDetailPictureClass .= ' js_gallery-link fancybox.ajax';
                        }

                        $bCarouselImgIsset = false;
                        $sCarouselDefaultHTML = '';
                    ?>
                    <?php if ($bHaveOffer):?>
                        <?php foreach ($arResult['OFFERS'] as $iOfferKey => $arOffer): ?>
                            <?php
                            if (
                                ($iOfferKey == $arResult['OFFERS_SELECTED'] || !$bCarouselImgIsset && $sCarouselDefaultHTML == '') &&
                                is_array($arOffer['PRODUCT_PHOTO']) && count($arOffer['PRODUCT_PHOTO']) > 0
                            ):
                            ?>
                                <?php
                                if ($iOfferKey == $arResult['OFFERS_SELECTED']) {
                                    $bCarouselImgIsset = true;
                                } else if ($sCarouselDefaultHTML == '') {
                                    ob_start();
                                }
                                ?>

                                <?php foreach ($arOffer['PRODUCT_PHOTO'] as $arPhoto): ?>
                                    <a class="<?=$sDetailPictureClass?>"<?php if ($arParams['USE_PICTURE_GALLERY'] == 'Y'):?> href="<?=$arResult['DETAIL_PAGE_URL']; endif?>" data-dot="<img class='owl-preview' src='<?=$arPhoto['RESIZE']['small']['src']?>'>" data-offer-id="<?=$arOffer['ID']?>">
                                        <img class="picbox__img" src="<?=$arPhoto['RESIZE']['big']['src']?>" data-large="<?=$arPhoto['SRC']?>" alt="<?=$strAlt?>" title="<?=$strTitle?>">
                                    </a>
                                <?php endforeach; ?>

                                <?php
                                if (!$bCarouselImgIsset && $sCarouselDefaultHTML == '') {
                                    $sCarouselDefaultHTML = ob_get_clean();
                                }
                                ?>

                            <?php endif; ?>
                        <?php endforeach; ?>
                    <?php endif; ?>

                    <?php if (!empty($arResult['PRODUCT_PHOTO'])): ?>
                        <?php $bCarouselImgIsset = true; ?>
                        <?php foreach ($arResult['PRODUCT_PHOTO'] as $arPhoto): ?>
                            <a class="<?=$sDetailPictureClass?>"<?php if ($arParams['USE_PICTURE_GALLERY'] == 'Y'):?> href="<?=$arResult['DETAIL_PAGE_URL']; endif?>" data-dot="<img class='owl-preview' src='<?=$arPhoto['RESIZE']['small']['src']?>'>">
                                <img class="picbox__img" src="<?=$arPhoto['RESIZE']['big']['src']?>" data-large="<?=$arPhoto['SRC']?>" alt="<?=$strAlt?>" title="<?=$strTitle?>">
                            </a>
                        <?php endforeach; ?>
                    <?php endif; ?>

                    <?php if (!$bCarouselImgIsset): ?>
                        <?php if ($sCarouselDefaultHTML != ''): ?>
                            <?=$sCarouselDefaultHTML?>
                        <?php else: ?>
                            <span class="<?=$sDetailPictureClass?>" data-dot="<img class='owl-preview' src='<?=SITE_TEMPLATE_PATH?>/assets/img/noimg.png'>">
                                <img class="picbox__img" src="<?=SITE_TEMPLATE_PATH?>/assets/img/noimg.png">
                            </span>
                        <?php endif; ?>
                    <?php endif; ?>
                    </div>

                    <span class="catalog__corner corner"><span class="corner__in"><span class="corner__text">
                    <?php
                    if (isset($arResult['DAYSARTICLE2']) || isset($arItemShow['DAYSARTICLE2'])) {
                        echo Loc::getMessage('RS_SLINE.BCE_CATALOG.DAYSARTICLE');
                    } elseif (isset($arResult['QUICKBUY']) || isset($arItemShow['QUICKBUY'])) {
                        echo Loc::getMessage('RS_SLINE.BCE_CATALOG.QUICKBUY');
                    }
                    ?>
                    </span></span></span>

                    <div class="glass_lupa"></div>

                    <?php if (
                        isset($arResult['PROPERTIES'][$arParams['ICON_MEN_PROP'][$arResult['IBLOCK_ID']]]) &&
                        $arResult['PROPERTIES'][$arParams['ICON_MEN_PROP'][$arResult['IBLOCK_ID']]]['VALUE'] != '' ||
                        isset($arResult['PROPERTIES'][$arParams['ICON_WOMEN_PROP'][$arResult['IBLOCK_ID']]]) &&
                        $arResult['PROPERTIES'][$arParams['ICON_WOMEN_PROP'][$arResult['IBLOCK_ID']]]['VALUE'] != ''
                    ): ?>
                        <span class="detail__gender gender">

                        <?php
                        if (
                            isset($arResult['PROPERTIES'][$arParams['ICON_MEN_PROP'][$arResult['IBLOCK_ID']]]) &&
                            $arResult['PROPERTIES'][$arParams['ICON_MEN_PROP'][$arResult['IBLOCK_ID']]]['VALUE'] != ''
                        ):
                        ?>
                            <svg class="icon icon-men icon-svg"><use xlink:href="#svg-men"></use></svg>
                        <?php endif; ?>

                        <?php
                        if (
                            isset($arResult['PROPERTIES'][$arParams['ICON_WOMEN_PROP'][$arResult['IBLOCK_ID']]]) &&
                            $arResult['PROPERTIES'][$arParams['ICON_WOMEN_PROP'][$arResult['IBLOCK_ID']]]['VALUE'] != ''
                        ):
                        ?>
                            <svg class="icon icon-women icon-svg"><use xlink:href="#svg-women"></use></svg>
                        <?php endif; ?>

                        </span>
                    <?php endif; ?>

                    <span class="detail__stickers js_swap_hide"
                        <?php if (isset($arResult['DAYSARTICLE2']) || isset($arResult['QUICKBUY'])): ?>
                            style="display:none;"
                        <?php endif; ?>
                    >
                        <?php
                        if (
                            $arParams['ICON_NOVELTY_PROP'][$arResult['IBLOCK_ID']] &&
                            $arResult['PROPERTIES'][$arParams['ICON_NOVELTY_PROP'][$arResult['IBLOCK_ID']]]['VALUE'] == 'Y' ||
                            $arParams['NOVELTY_TIME'] && $arParams['NOVELTY_TIME'] >= (floor($_SERVER['REQUEST_TIME'] - MakeTimeStamp($arResult['DATE_ACTIVE_FROM'])) / 3600)
                        ):
                        ?>
                            <span class="sticker new">
                                <span class="sticker__text">
                                    <?=$arResult['PROPERTIES'][$arParams['ICON_NOVELTY_PROP'][$arResult['IBLOCK_ID']]]['NAME']?>
                                </span>
                            </span>
                        <?php endif; ?>

                        <?php
                        if (
                            $arParams['ICON_DISCOUNT_PROP'][$arResult['IBLOCK_ID']] &&
                            $arResult['PROPERTIES'][$arParams['ICON_DISCOUNT_PROP'][$arResult['IBLOCK_ID']]]['VALUE'] == 'Y' ||
                            $arItemShowPrice['DISCOUNT_DIFF_PERCENT']
                        ):
                        ?>
                            <!--<span class="sticker discount">
                                <span class="sticker__text">
                                    <?/*=$arResult['PROPERTIES'][$arParams['ICON_DISCOUNT_PROP'][$arResult['IBLOCK_ID']]]['NAME']*/?>
                                </span>
                            </span>-->
                        <?php endif; ?>

                        <?php
                        if (
                            $arParams['ICON_DEALS_PROP'][$arResult['IBLOCK_ID']] &&
                            $arResult['PROPERTIES'][$arParams['ICON_DEALS_PROP'][$arResult['IBLOCK_ID']]]['VALUE'] == 'Y'
                        ):
                        ?>
                            <span class="sticker action">
                                <span class="sticker__text">
                                    <?=$arResult['PROPERTIES'][$arParams['ICON_DEALS_PROP'][$arResult['IBLOCK_ID']]]['NAME']?>
                                </span>
                            </span>
                        <?php endif; ?>
                    </span>
                </div>

                <div class="picbox__mini">
                    <div class="picbox__scroll">
                        <div class="picbox__dots"></div>
                    </div>
                    <div class="scroll-element picbox__bar">
                        <div class="scroll-arrow scroll-arrow_less">
                            <svg class="icon icon-left icon-svg"><use xlink:href="#svg-left"></use></svg>
                        </div>
                        <div class="scroll-arrow scroll-arrow_more">
                            <svg class="icon icon-right icon-svg"><use xlink:href="#svg-right"></use></svg>
                        </div>
                        <div class="scroll-element_outer">
                            <div class="scroll-element_size"></div>
                            <div class="scroll-element_track"></div>
                            <div class="scroll-bar"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="col-xs-12 col-sm-12 col-md-7 col-lg-7 pull-right">
      <div class="row"> <?php // TODO: Описание offers/props/table/buy_form ?>
        <div class="col-xs-12 col-sm-6">
          <?php if ($bHaveOffer): ?>

          <?php if (is_array($arResult['OFFERS_EXT']['PROPERTIES']) && 0 < count($arResult['OFFERS_EXT']['PROPERTIES'])): ?>
              <div class="detail__offer_props clearfix">
                  <?php foreach ($arResult['OFFERS_EXT']['PROPERTIES'] as $sPropCode => $arProperty): ?>
                      <?php
                      $bIsColor = $bIsBtn = false;
                      $sOfferPropClass= 'offer_prop';
                      if (
                          is_array($arParams['OFFER_TREE_COLOR_PROPS'][$arItemShow['IBLOCK_ID']]) &&
                          in_array($sPropCode, $arParams['OFFER_TREE_COLOR_PROPS'][$arItemShow['IBLOCK_ID']])
                      ) {
                          $bIsColor = true;
                          $sOfferPropClass .= ' offer_prop-color';
                      } elseif (
                          is_array($arParams['OFFER_TREE_BTN_PROPS'][$arItemShow['IBLOCK_ID']]) &&
                          in_array($sPropCode, $arParams['OFFER_TREE_BTN_PROPS'][$arItemShow['IBLOCK_ID']])
                      ) {
                          $bIsBtn = true;
                          $sOfferPropClass .= ' offer_prop-btn';
                      }
                      ?>
                      <?php if ($bIsColor || $bIsBtn): ?>
                          <div class="<?=$sOfferPropClass?> js-offer_prop" data-code="<?=$sPropCode?>">
                              <div class="offer_prop__name"><?=$arResult['OFFERS_EXT']['PROPS'][$sPropCode]['NAME']?>:</div>
                              <ul class="offer_prop__values clearfix">
                                  <?php foreach ($arProperty as $value => $arValue): ?>
                                      <?php
                                      $sOfferPropValueClass = 'offer_prop__value';
                                      if ($arValue['FIRST_OFFER'] == 'Y') {
                                          $sOfferPropValueClass .= ' checked';
                                      } elseif ($arValue['DISABLED_FOR_FIRST'] == 'Y') {
                                          $sOfferPropValueClass .= ' disabled';
                                      }
                                      ?>
                                      <li class="<?=$sOfferPropValueClass?>" data-value="<?=htmlspecialcharsbx($arValue['VALUE'])?>">
                                          <?php if ($bIsColor): ?>
                                              <?php
                                              $sOfferPropIcon = is_array($arValue['PICT'])
                                                  ? 'background-image:url('.$arValue['PICT']['SRC'].')'
                                                  : 'background-color:'.$arResult['COLORS_TABLE'][ToUpper($arValue['VALUE'])]['RGB'];
                                              ?>
                                                  <span class="offer_prop__icon">
                                                      <span class="offer_prop__img" title="<?=$arValue['VALUE']?>" style="<?=$sOfferPropIcon?>"></span>
                                                  </span>
                                          <?php else: ?>
                                              <?=$arValue['VALUE']?>
                                          <?php endif; ?>
                                      </li>
                                  <?php endforeach; ?>
                              </ul>
                          </div>
                      <?php else: ?>
                          <?php $dropdownId = $this->getEditAreaId('offer_prop_'.$arResult['ID'].'_'.$arResult['OFFERS_EXT']['PROPS'][$sPropCode]['ID']) ?>
                          <div class="offer_prop prop_<?=$sPropCode?> js-offer_prop" data-code="<?=$sPropCode?>">
                              <div class="offer_prop__name"><?=$arResult['OFFERS_EXT']['PROPS'][$sPropCode]['NAME']?>:</div>
                              <div class="dropdown select">
                                  <ul class="offer_prop__values dropdown-menu" aria-labelledby="<?=$dropdownId?>">
                                  <?php foreach ($arProperty as $value => $arValue): ?>
                                      <?php if($arValue['FIRST_OFFER'] == 'Y'): ?>
                                          <li class="offer_prop__value checked" data-value="<?=htmlspecialcharsbx($arValue['VALUE'])?>">
                                              <a href="#"><?=$arValue['VALUE']?></a>
                                              <?php ob_start(); ?>
                                                  <span class="offer_prop__checked"><?=$arValue['VALUE']?></span>
                                               <?php $sOfferPropChecked = ob_get_clean();?>
                                          </li>
                                      <?php else: ?>
                                          <li class="offer_prop__value<?php if ($arValue['DISABLED_FOR_FIRST'] == 'Y'): ?> disabled<?php endif; ?>" data-value="<?=htmlspecialcharsbx($arValue['VALUE'])?>">
                                              <a href="#"><?=$arValue['VALUE']?></a>
                                          </li>
                                      <?php endif; ?>
                                  <?php endforeach; ?>
                                  </ul>
                                  <a class="dropdown-toggle select__btn" id="<?=$dropdownId?>" data-toggle="dropdown" aria-expanded="false" aria-haspopup="true" role="button" href="#">
                                      <svg class="select__icon icon icon-svg"><use xlink:href="#svg-down-round"></use></svg><?=$sOfferPropChecked?>
                                  </a>
                              </div>
                          </div>
                      <?php endif; ?>
                  <?php endforeach; ?>
              </div>
          <?php endif; ?>

          <?php else: ?>

          <?php $emptyProductProperties = empty($arResult['PRODUCT_PROPERTIES']); ?>
          <?php if ('Y' == $arParams['ADD_PROPERTIES_TO_BASKET'] && !$emptyProductProperties): ?>
              <div class="detail__product_props product_props">

                  <?php if (!empty($arResult['PRODUCT_PROPERTIES_FILL'])): ?>
                      <?php foreach ($arResult['PRODUCT_PROPERTIES_FILL'] as $propID => $propInfo): ?>
                          <input type="hidden" name="<?=$arParams['PRODUCT_PROPS_VARIABLE']; ?>[<?=$propID; ?>]" value="<?=htmlspecialcharsbx($propInfo['ID']); ?>">
                          <?php
                          if (isset($arResult['PRODUCT_PROPERTIES'][$propID])) {
                              unset($arResult['PRODUCT_PROPERTIES'][$propID]);
                          }
                          ?>
                      <?php endforeach; ?>
                  <?php endif; ?>

                  <?php $emptyProductProperties = empty($arResult['PRODUCT_PROPERTIES']); ?>

                  <?php if (!$emptyProductProperties): ?>
                      <?php foreach ($arResult['PRODUCT_PROPERTIES'] as $propID => $propInfo): ?>
                          <?php
                          $bIsColor = $bIsBtn = false;
                          $sOfferPropClass= 'offer_prop';
                          if (
                              $arResult['PROPERTIES'][$propID]['PROPERTY_TYPE'] == 'S' &&
                              $arResult['PROPERTIES'][$propID]['USER_TYPE'] == 'directory'
                          ) {
                              $bIsColor = true;
                              $sOfferPropClass .= ' offer_prop-color';
                          }
                          ?>
                          <div class="<?=$sOfferPropClass?>" data-code="<?=$propID?>">
                              <div class="offer_prop__name"><?=$arResult['PROPERTIES'][$propID]['NAME']?>:</div>
                              <ul class="offer_prop__values clearfix">
                              <?php
                              if (
                                  'L' == $arResult['PROPERTIES'][$propID]['PROPERTY_TYPE']
                                  && 'C' == $arResult['PROPERTIES'][$propID]['LIST_TYPE']
                                  || $bIsColor
                              ):
                              ?>
                                  <?php foreach($propInfo['VALUES'] as $valueID => $arValue): ?>
                                      <?php $sOfferPropValueClass = 'offer_prop__value'; ?>
                                      <li class="<?=$sOfferPropValueClass?>">
                                          <label>
                                              <input
                                                  class="js-product_prop"
                                                  type="radio"
                                                  name="<?=$arParams['PRODUCT_PROPS_VARIABLE']; ?>[<?=$propID; ?>]"
                                                  value="<?=$valueID; ?>"
                                                  <?=($valueID == $propInfo['SELECTED'] ? 'checked' : ''); ?>
                                              >
                                              <?php if ($bIsColor): ?>
                                                  <?php
                                                  $sOfferPropIcon = is_array($arValue['PICT'])
                                                      ? 'background-image:url('.$arValue['PICT']['SRC'].')'
                                                      : 'background-color:'.$arResult['COLORS_TABLE'][ToUpper($arValue['VALUE'])]['RGB'];
                                                  ?>
                                                      <span class="offer_prop__icon">
                                                          <span class="offer_prop__img" title="<?=$arValue['NAME']?>" style="<?=$sOfferPropIcon?>"></span>
                                                      </span>
                                              <?php else: ?>
                                                  <?=$arValue?>
                                              <?php endif; ?>
                                          </label>
                                      </li>
                                  <?php endforeach; ?>

                              <?php else: ?>
                                  <select class="js-product_prop" name="<?=$arParams['PRODUCT_PROPS_VARIABLE']; ?>[<?=$propID; ?>]"><?
                                  foreach($propInfo['VALUES'] as $valueID => $value)
                                  {
                                      ?><option value="<?=$valueID; ?>" <?=($valueID == $propInfo['SELECTED'] ? '"selected"' : ''); ?>><?=$value; ?></option><?
                                  }
                                  ?>
                                  </select>
                              <?php endif; ?>
                              </ul>
                          </div>
                      <?php endforeach; ?>

                  <?php endif; ?>
              </div>
          <?php endif; ?>

          <?php endif; ?>

          <?php if ($arResult['DISPLAY_PROPERTIES'] != ''): ?>
            <div class="prop_group__prop-table">
              <div class="props_group__name"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.PROPERTIES')?></div>
              <?php
              $arPropsShow = array_diff_key($arResult['DISPLAY_PROPERTIES'], $arPropsHide);
              $APPLICATION->IncludeComponent(
                  'redsign:grupper.list',
                  'al',
                  array(
                      'DISPLAY_PROPERTIES' => $arPropsShow,
                      'CACHE_TIME' => 36000,
                      'IS_MAIN' => 'Y'
                  ),
                  $component
              );?>
            </div>
          <? endif; ?>
        </div>
        <div class="col-xs-12 col-sm-6">
          <div class="detail__buy" itemprop="offers" itemscope itemtype="http://schema.org/<?=($bHaveOffer ? 'AggregateOffer' : 'Offer')?>">
              <?php if (!empty($arItemShowPrice)):

				/*if($_SERVER['HTTP_HOST'] == 'vgrote.ru') {
                	$show_price = $arItemShowPrice['DISCOUNT_VALUE'];
				} else {
                    // $arItemShowPrice['DISCOUNT_VALUE']= $arItemShowPrice['DISCOUNT_VALUE']-$arItemShowPrice['DISCOUNT_VALUE']*0.05;
					$show_price = $arItemShowPrice['DISCOUNT_VALUE']= ceil($arItemShowPrice['DISCOUNT_VALUE']/10) * 10;
				}*/

                  ?>
                  <div class="detail__price price">
                        <div class="n_price_block">
                          <?php if ($arItemShowPrice['DISCOUNT_DIFF'] != 0) { ?>
                            <div class="in_row">
                              <div class="in_old_price in_price">цена в магазине</div>
                              <div class="in_old_price_value"><?= $arItemShowPrice['PRINT_VALUE']; ?></div>
                            </div>
                            <div class="in_row">
                              <div class="in_new_price in_price">цена при оформлении заказа<br> на сайте</div>
                              <div class="in_new_price_value"><?= ceil($arItemShowPrice['DISCOUNT_VALUE']); ?> руб.</div>
                            </div>
                          <?php } else { ?>
                            <div class="in_row">
                              <div class="in_old_price in_price">цена в магазине</div>
                              <div class="in_old_price_value" style="font-size: 22px"><?= $arItemShowPrice['PRINT_VALUE']; ?></div>
                            </div>
                          <?php } ?>
                        </div>
                      <?php /* if ($arParams['SHOW_OLD_PRICE'] == 'Y'): ?>
                      <div class="price__pv js-price_pv-<?=$arItemShowPrice['PRICE_ID']?>">
                          <?php
                          if ($arItemShowPrice['DISCOUNT_DIFF']) {
                              echo $arItemShowPrice['PRINT_VALUE'];
                          }
                          ?>
                      </div>
                      <?php endif; */ ?>
                      <!--<div class="price__pdv js-price_pdv-<?/*=$arItemShowPrice['PRICE_ID']*/?>" itemprop="<?/*=($bHaveOffer ? 'lowPrice' : 'price')*/?>">
<?/*if($_SERVER['HTTP_HOST']=='vgrote.ru'){
echo $arItemShowPrice['DISCOUNT_VALUE'];
}else{
$arItemShowPrice['DISCOUNT_VALUE']= $arItemShowPrice['DISCOUNT_VALUE']-$arItemShowPrice['DISCOUNT_VALUE']*0.05;
echo $arItemShowPrice['DISCOUNT_VALUE']= ceil($arItemShowPrice['DISCOUNT_VALUE']/10) * 10;

}*/?> руб.</div>-->
                      <meta itemprop="<?=($bHaveOffer ? 'lowPrice' : 'price')?>" content="<?=$arItemShowPrice['DISCOUNT_VALUE']?>">
                      <meta itemprop="priceCurrency" content="<?=$arItemShowPrice['CURRENCY']?>">

                  </div>
              <?php endif; ?>

              <?php if ($arParams['USE_STORE'] == 'Y'): ?>
                  <div class="detail__stocks">
                      <?$APPLICATION->IncludeComponent(
                          "bitrix:catalog.store.amount",
                          "al",
                          array(
                              "ELEMENT_ID" => $arResult['ID'],
                              "STORE_PATH" => $arParams['STORE_PATH'],
                              "CACHE_TYPE" => $arParams['CACHE_TYPE'],
                              "CACHE_TIME" => $arParams['CACHE_TIME'],
                              "MAIN_TITLE" => $arParams['MAIN_TITLE'],
                              "USE_MIN_AMOUNT" =>  'N',
                              "USE_MIN_AMOUNT_TMPL" =>  $arParams['USE_MIN_AMOUNT'],
                              "MIN_AMOUNT" => $arParams['MIN_AMOUNT'],
                              "STORES" => $arParams['STORES'],
                              "SHOW_EMPTY_STORE" => $arParams['SHOW_EMPTY_STORE'],
                              "SHOW_GENERAL_STORE_INFORMATION" => $arParams['SHOW_GENERAL_STORE_INFORMATION'],
                              "USER_FIELDS" => $arParams['USER_FIELDS'],
                              "FIELDS" => $arParams['FIELDS'],
                              "OFFER_ID" => $arItemShow['ID']
                          ),
                          $component,
                          array('HIDE_ICONS'=>'Y')
                      );?>
                  </div>
              <?php elseif ($arParams['USE_QUANTITY_AND_STORES'] == 'Y'): ?>
                  <?php
                  $arMessage = array(getMessage('RS_SLINE.BCE_CATALOG.OUT_OF_STOCK'), getMessage('RS_SLINE.BCE_CATALOG.LIMITED_AVAILABILITY'), getMessage('RS_SLINE.BCE_CATALOG.IN_STOCK'));
                  $arClasses = array('is-outofstock', 'is-limited', 'is-instock');
                  $arSchemaAvailability = array('http://schema.org/OutOfStock', 'http://schema.org/LimitedAvailability', 'http://schema.org/InStock');
                  ?>
                  <div class="detail__stocks stocks tooltip">
                      <span><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.QUANTITY')?></span>
                      <span class="stocks__amount tooltip__link anchor"><?php
                          echo ($arParams['USE_MIN_AMOUNT'] == 'Y')
                              ? getStringCatalogStoreAmountEx($arItemShow['CATALOG_QUANTITY'], $arParams['MIN_AMOUNT'], $arMessage)
                              : $arItemShow['CATALOG_QUANTITY'];
                      ?></span><?php
                      ?><span class="stocks__sacle scale <?=getStringCatalogStoreAmountEx($arItemShow['CATALOG_QUANTITY'], $arParams['MIN_AMOUNT'], $arClasses)?>">
                          <svg class="scale__icon icon icon-scale icon-svg"><use xlink:href="#svg-scale"></use></svg>
                          <span class="scale__over" <?if($arItemShow['CATALOG_QUANTITY'] > 0){ echo ' style="width:100%"';}?>>
                              <svg class="scale__icon icon icon-scale icon-svg"><use xlink:href="#svg-scale"></use></svg>
                          </span>
                      </span>
                      <link itemprop="availability" href="<?=getStringCatalogStoreAmountEx($arItemShow['CATALOG_QUANTITY'], $arParams['MIN_AMOUNT'], $arSchemaAvailability)?>">
                  <script>
                  BX.message({
                  RS_SLINE_STOCK_IN_STOCK: '<?=GetMessageJS('RS_SLINE.BCE_CATALOG.IN_STOCK')?>',
                  RS_SLINE_STOCK_LIMITED_AVAILABILITY: '<?=GetMessageJS('RS_SLINE.BCE_CATALOG.LIMITED_AVAILABILITY')?>',
                  RS_SLINE_STOCK_OUT_OF_STOCK: '<?=GetMessageJS('RS_SLINE.BCE_CATALOG.OUT_OF_STOCK')?>',
                  });
                  </script>
                  </div>
              <?php endif; ?>

              <!--noindex-->
              <form name="buy_form">
                  <input type="hidden" name="<?=$arParams['ACTION_VARIABLE']?>" value="ADD2BASKET">
                  <input type="hidden" name="<?=$arParams['PRODUCT_ID_VARIABLE']?>" class="js-product_id" value="<?=$arItemShow['ID']?>">

                  <?php if ($arParams['USE_PRODUCT_QUANTITY']): ?>
                      <div class="detail__quantity clearfix">
                          <span><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.PRODUCT_QUANTITY')?></span>
                          <div class="quantity<?php if (!$arItemShow['CAN_BUY']): ?> disabled<?php endif ?> clearfix">
                              <i class="quantity__minus js-basket-minus"></i>
                              <input
                                  type="number"
                                  class="quantity__val quantity__input js-quantity<?php if ($arParams['USE_PRICE_COUNT']): ?> js-use_count<?php endif; ?>"
                                  name="<?=$arParams['PRODUCT_QUANTITY_VARIABLE']?>"
                                  value="<?=$arItemShow['CATALOG_MEASURE_RATIO']?>"
                                  step="<?=$arItemShow['CATALOG_MEASURE_RATIO']?>"
                                  min="<?=$arItemShow['CATALOG_MEASURE_RATIO']?>"
                                  max="<?=$arItemShow['CATALOG_QUANTITY']?>">
                              <i class="quantity__plus js-basket-plus"></i>
                          </div>
                          <span class="detail__measure js-measure"><?=$arResult['CATALOG_MEASURE_NAME']?></span>
                      </div>
                  <?php endif; ?>

                  <div class="detail__btns">
                      <a class="detail__add2cart added2cart btn" href="<?=$arParams['BASKET_URL']?>" title="<?=Loc::getMessage('RS_SLINE.BCE_CATALOG.MESS_BTN_IN_BASKET_TITLE')?>" rel="nofollow">
                          <svg class="icon icon-incart icon-svg"><use xlink:href="#svg-incart"></use></svg><br />
                          <?=Loc::getMessage('RS_SLINE.BCE_CATALOG.MESS_BTN_IN_BASKET')?>
                      </a>

                      <button class="detail__add2cart add2cart btn<?php if (!$arItemShow['CAN_BUY']): ?> disabled<?php endif; ?> js-add2cart" type="submit"<?php if (!$arItemShow['CAN_BUY']): ?> disabled<?php endif; ?>>
                          <svg class="icon icon-cart icon-svg"><use xlink:href="#svg-cart"></use></svg><?=($arParams['MESS_BTN_ADD_TO_BASKET'] != '' ? $arParams['MESS_BTN_ADD_TO_BASKET'] : Loc::getMessage('RS_SLINE.BCE_CATALOG.MESS_BTN_ADD_TO_BASKET'))?>
                      </button>

                      <?php if($arResult['PROPERTIES']['TOVAR_POD_ZAKAZ']['VALUE'] == "Да")
                        {?>
                        <div class="productOrder<?if ($arItemShow['CAN_BUY']){?> disabled<?}?>">
                          <span class="productOrder<?if ($arItemShow['CAN_BUY']){?> disabled<?}?>"><a href="/ajax/order-product.php" class="js_fancy_order btnMessage" data-name="<?=$arResult["NAME"]?>">Заказать товар</a></span>
                        </div>
                        <?php }else {
                          ?>
                            <div class="productNotice <?if ($arItemShow['CAN_BUY']){?> disabled<?}?>">
                              <?/*<span class="productNoticeCaption">   Нет в наличии
                              </span>*/?>
                              <span style="color: red; padding-bottom: 25px; font-size: 18px"><b>Нет в наличии</b></span>
                              <span><a href="#message_notice<?//=$arItem['ID']?>" id="messageButton" class="js_fancy_widnow_cst btnMessage productNoticeBtn">Уведомить о поступлении</a></span>
                              <input class="itemIdNotice" type="hidden" name="itemID" value="<?=$arItemShow["ID"]?>" />
                              <input class="itemNameNotice" type="hidden" value="<?=$arItemShow["NAME"]?>">
                              <input class="itemSubscribeUrl" type="hidden" name="itemSUBSCRIBE_URL" value="<?=$arItemShow["SUBSCRIBE_URL"]?>" />
                              <!------------------------ message ------------------------>
                              <?/*<div class="message_product" id="message_<?=$arItem['ID']?>" style="display:none;"></div>*/?>
                              <div class="message_product" id="message_notice" style="display:none;"></div>
                            </div>
                            <?php
                          //echo $arItem['ID']."\n".$arItem["SUBSCRIBE_URL"];
                        }?>

                      <?php
                      if ($arParams['USE_BUY1CLICK'] == 'Y'):
//$name = '['.$arResult['ID'].'] '.$arResult['NAME'];
                          $arBuy1click = array(
                              'RS_EXT_FIELD_0' => '['.$arResult['ID'].'] '.htmlspecialcharsbx($arResult['NAME'])
                          );
                      ?>
<?//print_r($arBuy1click);?>
                          <a class="detail__buy1click buy1click btn js-buy1click js-ajax_link <?if (!$arItemShow['CAN_BUY']){?> disabled<?}?>"
                              data-insert_data="<?=CUtil::PhpToJSObject($arBuy1click)?>"
                              href="<?=SITE_DIR?>buy1click/?def=1"
                              data-name="<?=$arResult['NAME']?>"
                              rel="nofollow"
                              data-fancybox-title="<?=Loc::getMessage('RS_SLINE.BCE_CATALOG.MESS_BTN_BUY1CLICK')?>"
                          >


                              <svg class="icon icon-phone icon-svg"><use xlink:href="#svg-phone-big"></use></svg><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.MESS_BTN_BUY1CLICK')?>
                          </a>
                      <?php endif; ?>
                  </div>
              </form>
              <!--/noindex-->

              <?php
              if (isset($arResult['DAYSARTICLE2'])) {
                  $arTimers[] = $arResult['DAYSARTICLE2'];
              }
              if (isset($arResult['QUICKBUY'])) {
                  $arTimers[] = $arResult['QUICKBUY'];
              }
              if (is_array($arResult['OFFERS'])) {
                  foreach ($arResult['OFFERS'] as $arOffer) {
                      if (isset($arOffer['DAYSARTICLE2'])) {
                          $arTimers[] = $arOffer['DAYSARTICLE2'];
                      }
                      if (isset($arOffer['QUICKBUY'])) {
                          $arTimers[] = $arOffer['QUICKBUY'];
                      }
                  }
              }
              if (is_array($arTimers) && 0 < count($arTimers)):
                  $have_vis = false;

                  foreach ($arTimers as $arTimer):
                      $KY = 'TIMER';
                      if (isset($arTimer['DINAMICA_EX'])) {
                          $KY = 'DINAMICA_EX';
                      }
                      $jsTimer = array(
                          'DATE_FROM' => $arTimer[$KY]['DATE_FROM'],
                          'DATE_TO' => $arTimer[$KY]['DATE_TO'],
                          'AUTO_RENEWAL' => $arTimer['AUTO_RENEWAL'],
                      );
                      if (isset($arTimer['DINAMICA'])) {
                          $jsTimer['DINAMICA_DATA'] = $arTimer['DINAMICA'] == 'custom' ? array_flip(unserialize($arTimer['DINAMICA_DATA'])) : $arTimer['DINAMICA'];
                      }
                      ?>
                      <div class="detail__timer timer js_timer timer_bg" style="display:<?
                          echo (($arResult['ID'] == $arTimer['ELEMENT_ID'] || $arItemShow['ID'] == $arTimer['ELEMENT_ID']) && !$have_vis) ? 'block' : 'none'
                      ?>;" data-offer-id="<?=$arTimer['ELEMENT_ID']?>" data-timer="<?=CUtil::PhpToJSObject($jsTimer)?>">
                          <div class="timer__data">
                              <div class="timer__cell" style="display:none">
                                  <div class="timer__val js_timer-d">00</div>
                                  <div class="timer__note"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.TIMER_DAY')?></div>
                              </div>
                              <div class="timer__cell" style="display:none">:</div>
                              <div class="timer__cell">
                                  <div class="timer__val js_timer-H">00</div>
                                  <div class="timer__note"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.TIMER_HOUR')?></div>
                              </div>
                              <div class="timer__cell">:</div>
                              <div class="timer__cell">
                                  <div class="timer__val js_timer-i">00</div>
                                  <div class="timer__note"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.TIMER_MIN')?></div>
                              </div>
                              <div class="timer__cell">:</div>
                              <div class="timer__cell">
                                  <div class="timer__val js_timer-s">00</div>
                                  <div class="timer__note"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.TIMER_SEC')?></div>
                              </div>
                              <?php if (isset($arTimer['TIMER']) && $arQuickbuy['DATA']['QUANTITY'] > 0): ?>
                                  <div class="timer__cell timer__sep"></div>
                                  <div class="timer__cell">
                                      <div>
                                          <div class="timer__val"><?=($arTimer['QUANTITY'] > 99 ? $arTimer['QUANTITY'] : sprintf('%02d', $arTimer['QUANTITY']))?></div>
                                          <div class="sq"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.TIMER_MEASURE')?></div>
                                      </div>
                                      <div class="timer__note"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.TIMER_LEFT')?></div>
                                  </div>
                              <?php elseif (isset($arTimer['DINAMICA_EX'])): ?>
                                  <div class="timer__cell timer__sep"></div>
                                  <div class="timer__cell">
                                      <div class="timer__val js_timer-progress">0%</div>
                                      <div class="timer__note"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.TIMER_SOLD')?></div>
                                  </div>
                              <?php endif; ?>
                          </div>
                          <div class="timer__bottom">
                              <?=Loc::getMessage('RS_SLINE.BCE_CATALOG.TIMER_PRICE_DIFF');?>
                              <span class="discount"><?=$arItemShowPrice['PRINT_DISCOUNT_DIFF']?></span>
                          </div>
                      </div>
                  <?php endforeach; ?>
              <?php endif; ?>

              <?php if ($arParams['USE_SHARE'] == 'Y'): ?>
                  <div class="detail__share ya-share2"
                      <?php if ($arParams['SOCIAL_COUNTER'] == 'Y'): ?>
                          data-counter
                      <?php endif; ?>
                      <?php if ($arParams['SOCIAL_COPY'] != 'last'): ?>
                          data-copy="<?=$arParams['SOCIAL_COPY']?>"
                      <?php endif; ?>
                      <?php if (intval($arParams['SOCIAL_LIMIT']) > 0): ?>
                          data-limit="<?=$arParams['SOCIAL_LIMIT']?>"
                      <?php endif; ?>
                      <?php if (is_array($arParams['SOCIAL_SERVICES'])): ?>
                          data-services="<?=implode(',', $arParams['SOCIAL_SERVICES']);?>"
                      <?php endif; ?>
                      <?php if (intval($arParams['SOCIAL_SIZE']) > 0): ?>
                          data-size="<?=$arParams['SOCIAL_SIZE']?>"
                      <?php endif; ?>
                      data-lang="<?=LANGUAGE_ID?>"
                  <?/*?> data-bare=""*/?>></div>
              <?php endif; ?>

              <?php if ($arParams['USE_KREDIT'] == 'Y' && $arParams['KREDIT_URL'] != ''): ?>
                  <a class="detail__credit" href="<?=$arParams['KREDIT_URL']?>">
                      <i class="icon-png"></i><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.MESS_BTN_BUY_KREDIT')?>
                  </a>
              <?php endif; ?>

              <?php
              if (
                  isset($arResult['PROPERTIES'][$arParams['DELIVERY_PROP']]) &&
                  $arResult['DISPLAY_PROPERTIES'][$arParams['DELIVERY_PROP']]['DISPLAY_VALUE'] != ''
              ):
              ?>
                  <div class="detail__delivery" href="<?=$arParams['KREDIT_URL']?>">
                      <i class="icon-png"></i><?=$arResult['DISPLAY_PROPERTIES'][$arParams['DELIVERY_PROP']]['DISPLAY_VALUE']?>
                  </div>
              <?php elseif ($arResult['PROPERTIES'][$arParams['DELIVERY_PROP']]['VALUE'] != ''): ?>
                  <div class="detail__delivery delivery">
                      <i class="icon-png"></i><?=$arResult['PROPERTIES'][$arParams['DELIVERY_PROP']]['VALUE']?>
                  </div>
              <?php endif; ?>

              <?php if ($arParams['DISPLAY_COMPARE'] == 'Y'): ?>
                  <a class="cmp__link js-compare" href="<?=str_replace('#ID#', $arItemShow['ID'], $arResult['COMPARE_URL_TEMPLATE'])?>" rel="nofollow">
                      <svg class="cmp__icon icon icon-cmp icon-svg"><use xlink:href="#svg-cmp"></use></svg><?=($arParams['MESS_BTN_COMPARE'] != '' ? $arParams['MESS_BTN_COMPARE'] : Loc::getMessage('RS_SLINE.BCE_CATALOG.MESS_BTN_COMPARE'))?>
                  </a>
              <?php endif; ?>

          </div>
        </div>
      </div>
      <div class="row"> <?php // TODO: Описание Краткое/доставка ?>
        <div class="col-xs-12 col-sm-6">
          <?php if ($arResult['DETAIL_TEXT'] != ''): ?>
            <div class="prop_group__detail-text">
              <div class="props_group__name"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.S.DESCRIPTION')?></div>
              <div class="detail__preview" style="max-height:200px;"><?=$arResult['DETAIL_TEXT']?></div>
            </div>
          <?php endif; ?>
        </div>

        <div class="col-xs-12 col-sm-6">
<div class="payment_types">
    <div class="props_group__name">Способы оплаты</div><ul class="payments-list" style="
    overflow: hidden;
    padding: 0;
    margin: 0;
">
    <li><img src="/local/templates/al_default2/assets/img/receipt.png">
    <div>Наложенный платеж</div>
</li>
<li><img src="/local/templates/al_default2/assets/img/shopping-store.png"> <div>Банковская карта</div></li>
<li><img src="/local/templates/al_default2/assets/img/wallet.png"><div>Оплата наличными курьеру</div></li>

</ul>

    </div>
          <div class="detail__delivery-info">
            <div class="props_group__name">Доставка в <span class="delivery-info__city"><a id="fancy" href="/local/ajax/citychange.php?url=<?=$APPLICATION->GetCurPageParam("",array('cityname'))?>" rel="nofollow"><?=$_SESSION['city']?></a></span></div>
            <table class="props_group__props props_group__props_delivery">
              <thead>
                <tr>
                  <td></td>
                  <td>Стоимость</td>
                  <td>Срок доставки</td>
                </tr>
              </thead>
              <tbody>
                <?php foreach ($postShipmentsPrice as $key => $value): ?>
                    <?php if (!empty($value['VALUE'])): ?>
                        <tr>
                          <td class="detail__delivery_name detail__delivery_icon_rp">Почта России</td>
                            <td><?=round($value['VALUE']) ?> р.</td>
                            <td>3-9 дней</td>
                        </tr>
                    <?php endif ?>
                <?php endforeach ?>


                <?php foreach ($arShipment as $key => $value): ?>
                    <?php if (!empty($value)): ?>
                        <tr>
                          <td class="detail__delivery_name detail__delivery_icon_sdek"><?=$value['name'] ?></td>
                          <td><?=$value['price'] ?></td>
                          <td><?=$value['period'] ?></td>
                        </tr>
                    <?php endif ?>
                <?php endforeach ?>

               <!--  <tr>
                  <td class="detail__delivery_name detail__delivery_icon_energ">Транспортная<br />компания «Энергия»</td>
                  <td>-</td>
                  <td>-</td>
                </tr> -->
                <? if($_SESSION['city'] == 'Омск'): ?>
                <tr>
                  <td class="detail__delivery_name detail__delivery_icon_self">Самовывоз</td>
					<td>0 р.</td>
                  <td>Сегодня</td>
                </tr>
                <? endif; ?>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    <div class="col-xs-12">
        <a class="detail__detail_link" href="<?=$arResult['DETAIL_PAGE_URL']?>">
        <?=Loc::getMessage('GO2DETAIL_FROM_POPUP')?>
        </a>
    </div>
    </div>
</div></div>
<?php $templateData['TEMPLATE_ELEMENT'] = ob_get_flush(); ?>

    <?php
    if (is_array($arParams['TAB_IBLOCK_PROPS']) && count($arParams['TAB_IBLOCK_PROPS'])>0)
    {
        foreach ($arParams['TAB_IBLOCK_PROPS'] as $sPropCode)
        {
            $arPropsHide[$sPropCode] = $sPropCode;
        }
    }
    $arPropsShow = array_diff_key($arResult['DISPLAY_PROPERTIES'], $arPropsHide);
    //unset($arPropsShow['USER_DETAIL_TEXT']);
    ?>
        <?$arResult['TABS']['DETAIL_TEXT'] = $arResult['PROPERTIES']['USER_DETAIL_TEXT']['~VALUE']['TEXT']?>
    <div class="detail__tabs col-xs-12 col-md-10 col-md-offset-1">
        <ul class="nav-tabs" role="tablist">

            <?php if ($arResult['TABS']['DETAIL_TEXT']): ?>
                <li class="active">
                    <a rel="nofollow" href="#detail_detail" data-toggle="tab"><?=Loc::getMessage('TAB_NAME_DESCRIPTION')?></a>
                </li>
            <?php endif; ?>

            <?php if (!empty($arPropsShow)): ?>
                <li<?php if (!$arResult['TABS']['DETAIL_TEXT']): ?> class="active"<?php endif; ?>>
                    <a rel="nofollow" href="#detail_props" data-toggle="tab"><?=Loc::getMessage('TAB_NAME_PROPERTIES')?></a>
                </li>
            <?php endif; ?>

            <?php if ($arResult['TABS']['TAB_PROPERTIES']): ?>
                <?php foreach ($arParams['TAB_IBLOCK_PROPS'] as $iPropKey => $sPropCode): ?>
                    <?php if ($sPropCode != '' && !empty($arResult['PROPERTIES'][$sPropCode]['VALUE'])): ?>
                        <li<?php if (!$arResult['TABS']['DETAIL_TEXT'] && !$arResult['TABS']['DISPLAY_PROPERIES'] && $iPropKey == 0): ?> class="active"<?php endif; ?>>
                            <a rel="nofollow" href="#detail_<?=strtolower($sPropCode)?>" data-toggle="tab"><?=$arResult['PROPERTIES'][$sPropCode]['NAME']?></a>
                        </li>
                    <?php endif; ?>
                <?php endforeach; ?>
            <?php endif; ?>

            <?php if ($arResult['TABS']['REVIEW']): ?>
                <li<?php if (!$arResult['TABS']['DETAIL_TEXT'] && !$arResult['TABS']['DISPLAY_PROPERIES'] && !$arResult['TABS']['TAB_PROPERTIES']): ?> class="active"<?php endif; ?>>
                    <a rel="nofollow" href="#detail_reviews" data-toggle="tab"><?=Loc::getMessage('TAB_NAME_REVIEWS')?></a>
                </li>
            <?php endif; ?>
        </ul>
        <div class="tab-content">
            <?php if ($arResult['TABS']['DETAIL_TEXT']): ?>
                <div id="detail_detail" class="tab-pane fade in active">
                    <?=$arResult['PROPERTIES']['USER_DETAIL_TEXT']['~VALUE']['TEXT'];//$arResult['DETAIL_TEXT']?>
                </div>
            <?php endif; ?>

            <?php if (!empty($arPropsShow)): ?>
                <div id="detail_props" class="tab-pane fade <?php if (!$arResult['TABS']['DETAIL_TEXT']): ?> in active<?php endif; ?>">
                  <div class="props_group__name"><?=Loc::getMessage('RS_SLINE.BCE_CATALOG.DET.PROPERTIES')?></div>
                    <?$APPLICATION->IncludeComponent(
                        'redsign:grupper.list',
                        'al',
                        array(
                            'DISPLAY_PROPERTIES' => $arPropsShow,
                            'CACHE_TIME' => 36000
                        ),
                        $component
                    );?>
                </div>
            <?php endif; ?>

            <?php if ($arResult['TABS']['TAB_PROPERTIES']): ?>
                <?php foreach ($arParams['TAB_IBLOCK_PROPS'] as $iPropKey => $sPropCode): ?>
                    <?php if ($sPropCode != '' && !empty($arResult['PROPERTIES'][$sPropCode]['VALUE'])): ?>
                        <div id="detail_<?=strtolower($sPropCode)?>" class="tab-pane fade <?php if (!$arResult['TABS']['DETAIL_TEXT'] && !$arResult['TABS']['DISPLAY_PROPERIES'] && $iPropKey == 0): ?> in active<?php endif; ?>">
                        <?php if ($arResult['PROPERTIES'][$sPropCode]['PROPERTY_TYPE'] == 'F'): ?>
                            <div class="row">
                                <?php foreach ($arResult['PROPERTIES'][$sPropCode]['VALUE'] as $arDoc): ?>
                                    <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                        <div class="doc">
                                            <div class="doc__type">
                                                <i class="doc__icon <?=$arDoc['TYPE']?>"></i>
                                            </div>
                                            <div class="doc__inner">
                                                <a class="doc__name" href="<?=$arDoc['FULL_PATH']?>" target="_blank" rel="nofollow">
                                                    <?=($arDoc['DESCRIPTION'] == '' ? $arDoc['ORIGINAL_NAME'] : $arDoc['DESCRIPTION'])?>
                                                </a>
                                                <div class="doc__size">(<?if ($arDoc['TYPE2'] != ''){ echo $arDoc['TYPE2'].', '; } echo $arDoc['SIZE']?>)</div>
                                            </div>
                                        </div>
                                    </div>
                                <?php endforeach; ?>
                            </div>
                        <?php
                        elseif (
                            $arResult['PROPERTIES'][$sPropCode]['PROPERTY_TYPE'] == 'E' &&
                            count($arResult['PROPERTIES'][$sPropCode]['VALUE']) > 0
                        ):
                        ?>
                            <?php
                            $IBLOCK_ID = $arResult['PROPERTIES'][$sPropCode]['IBLOCK_ID'];
                            if (!isset($arSKU[$IBLOCK_ID])){
                                $arSKU[$IBLOCK_ID] = CCatalogSKU::GetInfoByProductIBlock($IBLOCK_ID);
                            }
                            ?>
                             <?$APPLICATION->IncludeComponent(
                                "bitrix:catalog.recommended.products",
                                "al",
                                array(
                                    "LINE_ELEMENT_COUNT" => $arParams["ALSO_BUY_ELEMENT_COUNT"],
                                    "ID" => $arResult['ID'],
                                    "PROPERTY_LINK" => $sPropCode,
                                    "CACHE_TYPE" => $arParams["CACHE_TYPE"],
                                    "CACHE_TIME" => $arParams["CACHE_TIME"],
                                    "BASKET_URL" => $arParams["BASKET_URL"],
                                    "ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"],
                                    "PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"],
                                    "PRODUCT_QUANTITY_VARIABLE" => $arParams["PRODUCT_QUANTITY_VARIABLE"],
                                    "ADD_PROPERTIES_TO_BASKET" => (isset($arParams["ADD_PROPERTIES_TO_BASKET"]) ? $arParams["ADD_PROPERTIES_TO_BASKET"] : ''),
                                    "PRODUCT_PROPS_VARIABLE" => $arParams["PRODUCT_PROPS_VARIABLE"],
                                    "PARTIAL_PRODUCT_PROPERTIES" => (isset($arParams["PARTIAL_PRODUCT_PROPERTIES"]) ? $arParams["PARTIAL_PRODUCT_PROPERTIES"] : ''),
                                    "PAGE_ELEMENT_COUNT" => $arParams["ALSO_BUY_ELEMENT_COUNT"],
                                    "SHOW_OLD_PRICE" => "Y",//need
                                    "SHOW_DISCOUNT_PERCENT" => "Y",//need
                                    "PRICE_CODE" => $arParams["PRICE_CODE"],
                                    "SHOW_PRICE_COUNT" => $arParams["SHOW_PRICE_COUNT"],
                                    "PRODUCT_SUBSCRIPTION" => 'N',
                                    "PRICE_VAT_INCLUDE" => $arParams["PRICE_VAT_INCLUDE"],
                                    "USE_PRODUCT_QUANTITY" => $arParams['USE_PRODUCT_QUANTITY'],
                                    "SHOW_NAME" => "Y",
                                    "SHOW_IMAGE" => "Y",
                                    "MESS_BTN_BUY" => $arParams['MESS_BTN_BUY'],
                                    "MESS_BTN_DETAIL" => $arParams["MESS_BTN_DETAIL"],
                                    "MESS_NOT_AVAILABLE" => $arParams['MESS_NOT_AVAILABLE'],
                                    "MESS_BTN_SUBSCRIBE" => $arParams['MESS_BTN_SUBSCRIBE'],
                                    "SHOW_PRODUCTS_".$arParams["IBLOCK_ID"] => "Y",
                                    "HIDE_NOT_AVAILABLE" => $arParams["HIDE_NOT_AVAILABLE"],
                                    "OFFER_TREE_PROPS_".$arSKU[$IBLOCK_ID]['IBLOCK_ID'] => $arParams["OFFER_TREE_PROPS"][$arSKU[$IBLOCK_ID]['IBLOCK_ID']],
                                    "OFFER_TREE_COLOR_PROPS_".$arSKU[$IBLOCK_ID]['IBLOCK_ID'] => $arParams["OFFER_TREE_COLOR_PROPS"][$arSKU[$IBLOCK_ID]['IBLOCK_ID']],
                                    "ADDITIONAL_PICT_PROP_".$IBLOCK_ID => $arParams['ADDITIONAL_PICT_PROP'][$arParams['IBLOCK_ID']],
                                    "PROPERTY_CODE_".$arParams['IBLOCK_ID'] => $arParams["LIST_PROPERTY_CODE"],
                                    "BRAND_PROP_".$arParams['IBLOCK_ID'] => $arParams['BRAND_PROP'][$arParams['IBLOCK_ID']],
                                    "ICON_NOVELTY_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_NOVELTY_PROP'][$arParams['IBLOCK_ID']],
                                    "ICON_DEALS_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_DEALS_PROP'][$arParams['IBLOCK_ID']],
                                    "ICON_DISCOUNT_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_DISCOUNT_PROP'][$arParams['IBLOCK_ID']],
                                    "ICON_MEN_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_MEN_PROP'][$arParams['IBLOCK_ID']],
                                    "ICON_WOMEN_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_WOMEN_PROP'][$arParams['IBLOCK_ID']],
                                    "ADDITIONAL_PICT_PROP_".$arSKU[$IBLOCK_ID]['IBLOCK_ID'] => $arParams['OFFER_ADDITIONAL_PICT_PROP'],
                                    "PROPERTY_CODE_".$arSKU[$IBLOCK_ID]['IBLOCK_ID'] => $arParams["LIST_OFFERS_PROPERTY_CODE"],
                                    "CONVERT_CURRENCY" => $arParams["CONVERT_CURRENCY"],
                                    "CURRENCY_ID" => $arParams["CURRENCY_ID"],
                                    'USE_LIKES' => $arParams['USE_LIKES'],
                                    'USE_SHARE' => $arParams['USE_SHARE'],
                                    'SOCIAL_SERVICES' => $arParams['LIST_SOCIAL_SERVICES'],
                                    'SOCIAL_COUNTER' => $arParams['SOCIAL_COUNTER'],
                                    'SOCIAL_COPY' => $arParams['SOCIAL_COPY'],
                                    'SOCIAL_LIMIT' => $arParams['SOCIAL_LIMIT'],
                                    'SOCIAL_SIZE' => $arParams['SOCIAL_SIZE'],
                                    'POPUP_DETAIL_VARIABLE' => $arParams['POPUP_DETAIL_VARIABLE'],
                                ),
                                $component,
                                array('HIDE_ICONS' => 'Y')
                            );?>

                        <?php elseif ($arResult['PROPERTIES'][$sPropCode]['MULTIPLE'] == 'Y'): ?>
                            <div class="props_group">
                                <div class="props_group__name"><?=$arrValue['GROUP']['NAME']?></div>
                                <table class="props_group__props">
                                    <tbody>
                                    <?php foreach ($arResult['PROPERTIES'][$sPropCode]['VALUE'] as $iPropKey => $sProp): ?>
                                        <tr>
                                            <th><?=$arResult['PROPERTIES'][$sPropCode]["DESCRIPTION"][$iPropKey]?></th>
                                            <td><span><?=$sProp?></td>
                                        </tr>
                                    <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                        <?php else: ?>
                            <?php
                            if ($arResult['PROPERTIES'][$sPropCode]['VALUE']['TYPE'] == 'text') {
                                echo $arResult['PROPERTIES'][$sPropCode]['VALUE']['TEXT'];
                            } else {
                                echo $arResult['DISPLAY_PROPERTIES'][$sPropCode]['DISPLAY_VALUE'];
                            }
                            ?>
                        <?php endif; ?>
                        </div>
                    <?php endif; ?>
                <?php endforeach; ?>
            <?php endif; ?>
            <? // --> component_epilog.php continue ?>

<?php
$this->SetViewTarget('rs_detail-linked_items');
foreach ($arParams['LINKED_ITEMS_PROPS'] as $sPropCode){
    if (!empty($arResult['PROPERTIES'][$sPropCode]['VALUE'])){
        $IBLOCK_ID = $arResult['PROPERTIES'][$sPropCode]['IBLOCK_ID'];
        if (!isset($arSKU[$IBLOCK_ID])){
            $arSKU[$IBLOCK_ID] = CCatalogSKU::GetInfoByProductIBlock($IBLOCK_ID);
        }

        $APPLICATION->IncludeComponent(
            "bitrix:catalog.recommended.products",
            "al",
            array(
                "LINE_ELEMENT_COUNT" => $arParams["ALSO_BUY_ELEMENT_COUNT"],
                "ID" => $arResult['ID'],
                "PROPERTY_LINK" => $sPropCode,
                "CACHE_TYPE" => $arParams["CACHE_TYPE"],
                "CACHE_TIME" => $arParams["CACHE_TIME"],
                "BASKET_URL" => $arParams["BASKET_URL"],
                "ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"],
                "PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"],
                "PRODUCT_QUANTITY_VARIABLE" => $arParams["PRODUCT_QUANTITY_VARIABLE"],
                "ADD_PROPERTIES_TO_BASKET" => (isset($arParams["ADD_PROPERTIES_TO_BASKET"]) ? $arParams["ADD_PROPERTIES_TO_BASKET"] : ''),
                "PRODUCT_PROPS_VARIABLE" => $arParams["PRODUCT_PROPS_VARIABLE"],
                "PARTIAL_PRODUCT_PROPERTIES" => (isset($arParams["PARTIAL_PRODUCT_PROPERTIES"]) ? $arParams["PARTIAL_PRODUCT_PROPERTIES"] : ''),
                "PAGE_ELEMENT_COUNT" => $arParams["ALSO_BUY_ELEMENT_COUNT"],
                "SHOW_OLD_PRICE" => "Y",//need
                "SHOW_DISCOUNT_PERCENT" => "Y",//need
                "PRICE_CODE" => $arParams["PRICE_CODE"],
                "SHOW_PRICE_COUNT" => $arParams["SHOW_PRICE_COUNT"],
                "PRODUCT_SUBSCRIPTION" => 'N',
                "PRICE_VAT_INCLUDE" => $arParams["PRICE_VAT_INCLUDE"],
                "USE_PRODUCT_QUANTITY" => $arParams['USE_PRODUCT_QUANTITY'],
                "SHOW_NAME" => "Y",
                "SHOW_IMAGE" => "Y",
                "MESS_BTN_BUY" => $arParams['MESS_BTN_BUY'],
                "MESS_BTN_DETAIL" => $arParams["MESS_BTN_DETAIL"],
                "MESS_NOT_AVAILABLE" => $arParams['MESS_NOT_AVAILABLE'],
                "MESS_BTN_SUBSCRIBE" => $arParams['MESS_BTN_SUBSCRIBE'],
                "SHOW_PRODUCTS_".$arParams["IBLOCK_ID"] => "Y",
                "HIDE_NOT_AVAILABLE" => $arParams["HIDE_NOT_AVAILABLE"],
                "OFFER_TREE_PROPS_".$arSKU[$IBLOCK_ID]['IBLOCK_ID'] => $arParams["OFFER_TREE_PROPS"][$arSKU[$IBLOCK_ID]['IBLOCK_ID']],
                "OFFER_TREE_COLOR_PROPS_".$arSKU[$IBLOCK_ID]['IBLOCK_ID'] => $arParams["OFFER_TREE_COLOR_PROPS"][$arSKU[$IBLOCK_ID]['IBLOCK_ID']],
                "ADDITIONAL_PICT_PROP_".$IBLOCK_ID => $arParams['ADDITIONAL_PICT_PROP'][$arParams['IBLOCK_ID']],
                "PROPERTY_CODE_".$arParams['IBLOCK_ID'] => $arParams["LIST_PROPERTY_CODE"],
                "BRAND_PROP_".$arParams['IBLOCK_ID'] => $arParams['BRAND_PROP'][$arParams['IBLOCK_ID']],
                "ICON_NOVELTY_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_NOVELTY_PROP'][$arParams['IBLOCK_ID']],
                "ICON_DEALS_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_DEALS_PROP'][$arParams['IBLOCK_ID']],
                "ICON_DISCOUNT_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_DISCOUNT_PROP'][$arParams['IBLOCK_ID']],
                "ICON_MEN_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_MEN_PROP'][$arParams['IBLOCK_ID']],
                "ICON_WOMEN_PROP_".$arParams['IBLOCK_ID'] => $arParams['ICON_WOMEN_PROP'][$arParams['IBLOCK_ID']],
                "ADDITIONAL_PICT_PROP_".$arSKU[$IBLOCK_ID]['IBLOCK_ID'] => $arParams['OFFER_ADDITIONAL_PICT_PROP'],
                "PROPERTY_CODE_".$arSKU[$IBLOCK_ID]['IBLOCK_ID'] => $arParams["LIST_OFFERS_PROPERTY_CODE"],
                "CONVERT_CURRENCY" => $arParams["CONVERT_CURRENCY"],
                "CURRENCY_ID" => $arParams["CURRENCY_ID"],
                'USE_LIKES' => $arParams['USE_LIKES'],
                'USE_SHARE' => $arParams['USE_SHARE'],
                'SOCIAL_SERVICES' => $arParams['LIST_SOCIAL_SERVICES'],
                'SOCIAL_COUNTER' => $arParams['SOCIAL_COUNTER'],
                'SOCIAL_COPY' => $arParams['SOCIAL_COPY'],
                'SOCIAL_LIMIT' => $arParams['SOCIAL_LIMIT'],
                'SOCIAL_SIZE' => $arParams['SOCIAL_SIZE'],
                'POPUP_DETAIL_VARIABLE' => $arParams['POPUP_DETAIL_VARIABLE'],
                "SECTION_TITLE" => $arResult['PROPERTIES'][$sPropCode]["NAME"],
            ),
            $component,
            array('HIDE_ICONS' => 'Y')
        );
    }
}
$this->EndViewTarget();
?>
<script type="text/javascript">
  $(document).ready(function(){
    if (screen.width < 992) {
      $('.catalog_items').addClass('js-catalog_slider owl-carousel').owlCarousel({
        loop:true,
        nav:true,
        navClass:['owl-nav__prev js-click', 'owl-nav__next js-click'],
        navText:['<svg class="icon-left icon-svg"><use xlink:href="#svg-left"></use></svg>','<svg class="icon-right icon-svg"><use xlink:href="#svg-right"></use></svg>'],
        responsive: {
          0: {
            items: 1
          },
          480: {
            items: 2
          },
          768: {
            items: 3
          }
        }
      });
    }
  });
</script>
<?php
//$templateData = $arResult;