Your IP : 3.139.72.173


Current Path : /home/bitrix/ext_www/coffe.land/include/page/main/
Upload File :
Current File : /home/bitrix/ext_www/coffe.land/include/page/main/banner_main.php

<?
$mainBanner = array();
$arSelect = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM","PROPERTY_*");//IBLOCK_ID и ID обязательно должны быть указаны, см. описание arSelectFields выше
$arFilter = Array("IBLOCK_ID"=>IntVal(IB_MAIN_MAINBANNER), "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array("SORT"=>"asc"), $arFilter, false, Array("nPageSize"=>50), $arSelect);
while($ob = $res->GetNextElement())
{
    $arProps = $ob->GetProperties();


    $mainBanner [] = array("IMG"=>CFile::GetPath($arProps["IMG"]["VALUE"]),"LINK"=>$arProps["LINK"]["VALUE"]);
}

?>

<div id="slider-contentCarrouselBlock" class="slideshow-container "
     data-cycle-timeout="0">
    <ul class="slideshow">
        <?foreach ($mainBanner as $elem):?>
            <li class="slider-item">
                <a title="_"
                   href="<?=$elem["LINK"]?>">
                    <img src="<?=$elem["IMG"]?>"
                         alt=""/>
                </a>
            </li>
        <?endforeach;?>
    </ul>
    <div class="slideshow-pager"></div>
</div>

<script>
    jQuery(document).ready(function () {
        setTimeout(function () {
            var b = Mage.Cookies.get("CUSTOMER_SEGMENT_IDS");
            if (null != b) {
                for (var c = b.split(","), d = jQuery(".slideshow-container .slideshow"), e = d.data("cycle.opts").slideCount + 1, f = 0; f <= e; f++) {
                    console.log("slide: " + f);
                    var g = jQuery(".slideshow-container .slideshow .cycle-slide").eq(f);
                    g.hasClass("non-customer") && !g.hasClass("cycle-sentinel") && d.cycle("remove", g.index() - 1);
                    var h = g.data("customerSegment");
                    void 0 === h || -1 !== c.indexOf(h.toString()) || g.hasClass("cycle-sentinel") || (console.log("remove data slide"), d.cycle("remove", g.index() - 1))
                }
                d.data("cycle.opts").slideCount > 0 ? (d.cycle("destroy"), a(d)) : d.cycle("destroy")
            } else {
                console.log("remove data customer segments slides");
                var d = jQuery(".slideshow-container .slideshow");
                d.cycle("destroy"), jQuery(".slideshow-container .slideshow li").each(function (a, b) {
                    void 0 !== jQuery(b).data("customerSegment") && jQuery(b).remove()
                }), a(d)
            }
        }, 200);
        var a = function (a) {
            jQuery(".slideshow-container .slideshow").cycle({
                slides: "> li",
                pager: ".slideshow-pager",
                pagerTemplate: '<span class="pager-box"></span>',
                speed: 600,
                pauseOnHover: !0,
                swipe: !0,
                prev: ".slideshow-prev",
                next: ".slideshow-next",
                fx: "scrollHorz"
            })
        }
    });
</script>