<!DOCTYPE html>
<html dir="<?php echo $direction; ?>" lang="<?php echo $lang; ?>">
<head prefix="og: http://ogp.me/ns#
            fb: http://ogp.me/ns/fb#
            product: http://ogp.me/ns/product#">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title><?php echo $title; ?></title>
    <base href="<?php echo $base; ?>" />
    <?php if ($description) { ?>
    <meta name="description" content="<?php echo $description; ?>" />
    <?php } ?>
    <?php if ($keywords) { ?>
    <meta name="keywords" content= "<?php echo $keywords; ?>" />
    <?php } ?>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script src="https://www.googletagmanager.com/gtag/js?id=G-4E63G2G1LD" async></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', 'G-4E63G2G1LD');
    </script>
    <!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
        new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
                j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
                'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
                })(window,document,'script','dataLayer','GTM-MFD4MFH');</script>
    <!-- End Google Tag Manager -->
    <!-- All css, bootstrap, animation files are combined in this file-->
    <link  rel="stylesheet" type="text/css" href="/catalog/view/theme/deercase/stylesheet/hamburgers.min.css?ver=0.0.121" />
    <!-- All css, bootstrap, animation files are combined in this file-->

    <link rel="apple-touch-icon" href="https://www.deercase.com/image/apple-touch/deercase-apple-original.jpeg"/>
    <link rel="apple-touch-icon" sizes="57x57" href="/image/apple-touch/deercase-apple-touch-icon.jpg"/>
    <link rel="apple-touch-icon" sizes="114x114" href="/image/apple-touch/deercase-apple-original_114x114"/>
    <link rel="apple-touch-icon" sizes="72x72" href="/image/apple-touch/deercase-apple-original_1_72x72.jpeg"/>
    <link rel="apple-touch-icon" sizes="144x144" href="/image/apple-touch/deercase-apple-original_2_144x144.jpeg"/>
    <link rel="apple-touch-icon" sizes="60x60" href="/image/apple-touch/deercase-apple-original_3_60x60.jpeg"/>
    <link rel="apple-touch-icon" sizes="120x120" href="/image/apple-touch/deercase-apple-original_4_120x120.jpeg"/>
    <link rel="apple-touch-icon" sizes="76x76" href="/image/apple-touch/deercase-apple-original_5_76x76.jpeg"/>
    <link rel="apple-touch-icon" sizes="152x152" href="/image/apple-touch/deercase-apple-original_6_152x152.jpeg"/>
    <link rel="apple-touch-icon" sizes="180x180" href="/image/apple-touch/deercase-apple-original_7_180x180.jpeg"/>

    <script async>
        var node=document.createElement('link');
        node.rel='stylesheet';
        node.href='https://fonts.googleapis.com/css?family=Quicksand:400,500,600,700&display=swap';
        node.type='text/css';
        var godefer=document.getElementsByTagName('link')[0];
        godefer.parentNode.insertBefore(node,godefer);
    </script>
    <?php if(1==2){
foreach ($styles as $style) {  ?>
    <link href="<?php echo $style['href']; ?>" type="text/css" rel="<?php echo $style['rel']; ?>" media="<?php echo $style['media']; ?>" />
    <?php } } ?>
    <?php foreach ($links as $link) { ?>
    <link href="<?php echo $link['href']; ?>" rel="<?php echo $link['rel']; ?>" />
    <?php } ?>
    <script src="https://www.deercase.com/catalog/view/theme/deercase/stylesheet/deviceatlas-custom-1.9.1-201007.min.js?a=<?=date("dmyhis")?>"></script>
    <script src="https://www.deercase.com/catalog/view/theme/deercase/stylesheet/jquery/jquery-2.1.1.min.js"></script>
    <script>
        $(document).ready(function () {
            function getDeviceInfo() {
                $.ajax('/index.php?route=piyerSoft/device').done(function (msg) {

                    var newBannerSet = [];

                    result = JSON.parse(msg);

                    var bannerSetItems = $(".BannerSet");

                    if (result.banners && result.banners.length > 0 && bannerSetItems.length > 0) {
                        for (var i=0; i < bannerSetItems.length; i++ ) {

                            for (var banner of result.banners) {

                                if ($(bannerSetItems[i]).data('modelid') != null && $(bannerSetItems[i]).data('modelid')>0 &&
                                    banner.model_id == $(bannerSetItems[i]).data('modelid')) {

                                    $(bannerSetItems[i]).children('a').attr('href', banner.link);
                                    $(bannerSetItems[i]).children('h3').children('a').attr('href', banner.link);
                                    //BannerSets[i].link = banner.link;
                                    //newBannerSet.push(BannerSets[i]);
                                }

                            }

                        }

                        //BannerSets = newBannerSet;

                    }
                    /*else {
                        console.log('no banner data!');
                    }*/

                    if (result.sliders && result.sliders.length > 0) {
                        for (var slider of result.sliders) {
                            $(".mbmid"+slider.model_id).attr('href', slider.link);
                        }
                    }
                    /*else {
                        console.log('no slider data!');
                    }*/

                    if (result.category_id) {
                        selectSearchDeviceModel(result.properties.manufacturer,result.category_id);
                    }

                    if (result.video_banner && result.video_banner.video_code && result.video_banner.video_code != '') {
                        $(".emcont").html(result.video_banner.video_code);
                    }

                    if (result.video_banner && result.video_banner.html_code && result.video_banner.html_code != '') {
                        $(".SEYMAxDEERCASE").html(result.video_banner.html_code);
                    }

                    <?php if ($_SERVER['REMOTE_ADDR']=='213.254.154.56'): ?>
                    //alert(msg);
                    //alert(document.cookie);
                    <?php endif; ?>
                    /*console.log('Model : ' + result.model);
                    console.log('Marketing Name : ' + result.marketingName);
                    console.log('Manufacturer : ' + result.manufacturer);
                    console.log('Screen Resolution : ' + result.displayWidth + ' x ' + result.displayHeight);*/
                });
            }
            getDeviceInfo();
        });
    </script>
    <?php foreach ($scripts as $script) { ?>
    <script src="<?php echo $script; ?>"></script>
    <?php } ?>
    <style>
        .lodaer_class{position:fixed;display:none;top:0;right:0;width:100%;height:100%;background-color:#FFF;background-repeat:no-repeat;background-position:center;z-index:10000000;filter: alpha(opacity=40);opacity:.8;transition:all .3s ease-out 0s}.loadinggif{position:fixed;top:50%;left:50%;z-index:101;width:110px;height:110px;transform:translate(-50%,-50%)}.err_msg{background:#c00;margin-top:20px}.err_msg p{text-align:center;color:#fff!important;padding:15px}
        #ScrollToTop
        {
            left: 24px !important;
        }
    </style>
    <!-- Tiktok Pixel -->
    <script>
        !function (w, d, t) {
            w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var i="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib="+t;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};


            ttq.load('C157T53DC3O8L39K9LJG');
            ttq.page();
        }(window, document, 'ttq');
    </script>

    <!-- Facebook Pixel -->
    <script  async>
        function facebook_loadScript(url, callback) {
            var script = document.createElement("script");
            script.type = "text/javascript";
            if(script.readyState) {  // only required for IE <9
                script.onreadystatechange = function() {
                    if (script.readyState === "loaded" || script.readyState === "complete") {
                        script.onreadystatechange = null;
                        if (callback) {
                            callback();
                        }
                    }
                };
            } else {  //Others
                if (callback) {
                    script.onload = callback;
                }
            }
            script.src = url;
            document.getElementsByTagName("head")[0].appendChild(script);
        }
    </script>
    <script  async>
        (function() {
            var enableCookieBar = '<?= $facebook_enable_cookie_bar ?>';
            if (enableCookieBar === 'true') {
                facebook_loadScript("catalog/view/javascript/facebook/cookieconsent.min.js");
// loading the css file
                var css = document.createElement("link");
                css.setAttribute("rel", "stylesheet");
                css.setAttribute("type", "text/css");
                css.setAttribute(
                    "href",
                    "catalog/view/theme/css/facebook/cookieconsent.min.css");
                document.getElementsByTagName("head")[0].appendChild(css);
                window.addEventListener("load", function(){
                    function setConsent() {
                        fbq(
                            'consent',
                            this.hasConsented() ? 'grant' : 'revoke'
                        );
                    }
                    window.cookieconsent.initialise({
                        palette: {
                            popup: {
                                background: '#237afc'
                            },
                            button: {
                                background: '#fff',
                                text: '#237afc'
                            }
                        },
                        cookie: {
                            name: fbq.consentCookieName
                        },
                        type: 'opt-out',
                        showLink: false,
                        content: {
                            dismiss: 'Agree',
                            deny: 'Opt Out',
                            header: 'Our Site Uses Cookies',
                            message: ''
                        },
                        layout: 'basic-header',
                        location: true,
                        revokable: true,
                        onInitialise: setConsent,
                        onStatusChange: setConsent,
                        onRevokeChoice: setConsent
                    }, function (popup) {
// If this isn't open, we know that we can use cookies.
                        if (!popup.getStatus() && !popup.options.enabled) {
                            popup.setStatus(cookieconsent.status.dismiss);
                        }
                    });
                });
            }
        })();
    </script>
    <script  async>
        (function() {
            !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
                    n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
                    n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
                    t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
                document,'script','https://connect.facebook.net/en_US/fbevents.js');
            var enableCookieBar = '<?= $facebook_enable_cookie_bar ?>';
            if (enableCookieBar === 'true') {
                fbq.consentCookieName = 'fb_cookieconsent_status';
                (function() {
                    function getCookie(t){var i=("; "+document.cookie).split("; "+t+"=");if(2==i.length)return i.pop().split(";").shift()}
                    var consentValue = getCookie(fbq.consentCookieName);
                    fbq('consent', consentValue === 'dismiss' ? 'grant' : 'revoke');
                })();
            }
            <?php if ($facebook_pixel_id_FAE) { ?>
                facebook_loadScript(
                    "https://www.deercase.com/catalog/view/javascript/facebook/facebook_pixel.js",
                    function() {
                        var params = <?= $facebook_pixel_params_FAE ?>;
                    _facebookAdsExtension.facebookPixel.init(
                    '<?= $facebook_pixel_id_FAE ?>',
                        <?= $facebook_pixel_pii_FAE ?>,
                        params);
                <?php if ($facebook_pixel_event_params_FAE) { ?>
                    _facebookAdsExtension.facebookPixel.firePixel(
                        JSON.parse('<?= $facebook_pixel_event_params_FAE ?>'));
                    <?php } ?>
            });
        <?php } ?>
        })();
    </script>
    <!-- Facebook Pixel -->
    <!-- Google Analytics & Ads Start-->
    <?php echo $gaecmadwconv_module; ?>
    <!-- Google Analytics & Ads End -->
    <style>
        .alert {
            font-size:20px;
            font-weight:bold}
    </style>
    <script>
        let storyClicked = [];
        function dataLayerPush(event, id, name, creative, location, index) {
            window.dataLayer.push({
                'event': event,
                'ecommerce': {
                    'items': [
                        {
                            'promotion_id': id,
                            'promotion_name': name,
                            'creative_name': creative,
                            'location_id': location,
                            'index': index,
                        }
                    ]
                }
            });
//if (event=='select_promotion') {alert('click:'+id);}
            //console.log('>>>['+event+']>>> id:('+id+') name:('+name+') location:('+location+') index:'+index);
        }
        function dataLayerButtonClick(name) {
            window.dataLayer.push({
                'event': 'Button_Click',
                'button': {
                    'name': name
                }
            });
            console.log('*btn click:'+name);
        }
        function dataLayerMenuClick(name, type="Hamburger") {
            window.dataLayer.push({
                'event': 'Menu_Click',
                'menu': {
                    'type': type,// Hamburger, Header, Story
                    'name': name
                }
            });
            console.log('*menu click:' + name + ' *menuType:' + type);
        }
    </script>
    <?php if ($class == 'common-home') { ?>
    <script type="application/ld+json">
{
 "@context": "https://schema.org",
 "@type": "WebSite",
 "url": "<?php echo $base; ?>",
 "name" : "<?php echo $store_name; ?>",
 "potentialAction": {
   "@type": "SearchAction",
   "target": "<?php echo $base; ?>index.php?route=product/search&search={search_term_string}",
   "query-input": "required name=search_term_string"
 }
}
</script>
    <script type="application/ld+json">
        { "@context" : "https://schema.org",
            "@type" : "Organization",
            <?php if ($logo) { ?>
        "logo" : "<?php echo $logo; ?>",
        <?php } ?>
        <?php if (!empty($support)) { ?>
        "contactPoint" : [
        { "@type" : "ContactPoint",
        "telephone" : "<?php echo $support; ?>",
        "contactType" : "customer service"
        } ],
        <?php } ?>
        <?php if (!empty($social)) { ?>
        "sameAs" : [<?php echo $social; ?>],
        <?php } ?>
        "url" : "<?php echo $base; ?>"
        }
    </script>
    <?php } ?>
    <?php if (!empty($open_graphs)){
                    foreach ($open_graphs as $open_graph ){
                        echo $open_graph;
                    }
                } ?>
    <!-- -->
</head>
<body class="<?php echo $class; ?>">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MFD4MFH"
                  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<!-- Hotjar Tracking Code for www.www.deercase.com -->
<script>
    (function(h,o,t,j,a,r){
        h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
        h._hjSettings={hjid:1786968,hjsv:6};
        a=o.getElementsByTagName('head')[0];
        r=o.createElement('script');r.async=1;
        r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
        a.appendChild(r);
    })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
<div class="hidden-in-category">
    <br class="visible-xs-and-sm" />
    <br class="visible-xs-and-sm" />
    <br class="visible-xs-and-sm" />
</div>
<?= $headertop; ?>
<?php if ($categories) { ?>
<div class="container-fluid p-0 custom-0001">
    <nav id="menu" class="navbar">
        <div class="container">
            <div id="logo">
                <a href="<?php echo $home; ?>"><img src="https://www.deercase.com/catalog/view/theme/deercase/image/deer-case-logo-86x30.png" title="<?php echo $name; ?>" alt="<?php echo $name; ?>" class="img-responsive" /></a>
            </div>
            <div class="navbar-header">
                <button id="mMenu-btn" class="hamburger hamburger--collapse o-0" type="button">
<span class="hamburger-box">
<span class="hamburger-inner custom-0003"></span>
</span>
                </button>
            </div>
            <div id="dDMenu" class="collapse navbar-collapse navbar-ex1-collapse pull-left">
                <ul class="nav navbar-nav">
                    <?php foreach ($categories as $category) { ?>
                    <?php if ($category['children']) { ?>
                    <li class="dropdown"><a href="<?php echo $category['href']; ?>" class="dropdown-toggle" data-toggle="dropdown" onclick="dataLayerMenuClick('<?=str_replace(' Telefon Kılıfı', '', $category['name']); ?>', 'header');window.location.href = '<?= $category ['href']; ?>';"><?= str_replace('Telefon Kılıfı', '', $category ['name']); ?></a>
                        <div class="dropdown-menu">
                            <div class="dropdown-inner">
                                <ul class="list-unstyled">
                                </ul>
                            </div>
                        </div>
                    </li>
                    <?php } else { ?>
                    <li><a href="<?php echo $category['href']; ?>" onclick="dataLayerMenuClick('<?=str_replace(' Telefon Kılıfı', '', $category['name']); ?>', 'header');"><?php echo $category['name']; ?></a></li>
                    <?php } ?>
                    <?php } ?>
                    <li><a href="iphone-11-pro-max-kisiye-ozel-telefon-kiliflari"><?= $text_customcase ?></a></li>
                    <li class="dropdown"><a class="dropdown-toggle" >Koleksiyonlar</a>
                        <div class="dropdown-menu">
                            <div class="dropdown-inner">
                                <ul class="list-unstyled">
                                    <li>
                                        <a href="/iphone-12-warner-bros-telefon-kilifi" class="text-center" onclick="dataLayerMenuClick('DC X DeerCase Koleksiyonu', 'header');">
                                            DC X DeerCase
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-12-movies-series-telefon-kilifi" class="text-center" onclick="dataLayerMenuClick('WB X DeerCase Koleksiyonu', 'header');">
                                            WB X DeerCase
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-x-seyma-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Şeyma X DeerCase Koleksiyonu', 'header');">
                                            Şeyma X DeerCase
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-11-pro-max-lansman-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Lansman Koleksiyonu', 'header');">
                                            Lansman
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-x-renkli-silikon-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Renkli Silikon Koleksiyonu', 'header');">
                                            Renkli Silikon
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-11-artycase-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('ArtyCase Koleksiyonu', 'header');">
                                            ArtyCase
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-12-slidecase-telefon-kilifi" class="text-center" onclick="dataLayerMenuClick('SlideCase Koleksiyonu', 'header');">
                                            SlideCase
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-x-isimli-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('İsmini Yaz Koleksiyonu', 'header');">
                                            İsmini Yaz
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-11-pro-max-burcu-x-deercase-telefon-kiliflari" class="text-center">
                                            Burcu X DeerCase
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-x-seffaf-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Şeffaf Koleksiyonu', 'header');">
                                            Şeffaf
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-x-simli-sulu-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Simli Sulu Koleksiyonu', 'header');">
                                            Simli Sulu
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-xs-max-neon-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Neon Koleksiyonu', 'header');">
                                            Neon
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-11-pro-mermer-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Mermer Koleksiyonu', 'header');">
                                            Mermer
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-x-harfli-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Alfabe Koleksiyonu', 'header');">
                                            Alfabe
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-xs-max-tutacakli-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Glossy Koleksiyonu', 'header');">
                                            Glossy
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/iphone-x-retro-telefon-kiliflari" class="text-center" onclick="dataLayerMenuClick('Retro Koleksiyonu', 'header');">
                                            Retro
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </li>
                    <li><a href="/guestorder" onclick="dataLayerMenuClick('Sipariş Sorgula', 'header');">Sipariş Sorgula</a></li>
                    <li><a href="/s-s-s" onclick="dataLayerMenuClick('S.S.S', 'header');">S.S.S</a></li>
                </ul>
            </div>
            <div class="HeaderButtons">
                <?php echo $cart; ?>
                <div class="btn-group pull-right AccountDD">
                    <button aria-label="Düğme" type="button" data-toggle="dropdown" class="btn btn-inverse btn-block btn-lg dropdown-toggle AccountDD__RootButton"><img src="https://www.deercase.com/catalog/view/theme/deercase/image/user.svg" alt="Kullanıcı İkonu" height="16"/></button>
                    <ul class="dropdown-menu pull-right AccountDD__Dropdown">
                        <? if ($logged): ?>
                        <li class="AccountDD__Item"><a class="AccountDD__ItemLink" href="<?= $account; ?>"><?= $text_account; ?></a></li>
                        <li class="AccountDD__Item"><a class="AccountDD__ItemLink" href="<?= $logout; ?>"><?= $text_logout; ?></a></li>
                        <? else: ?>
                        <div class="text-center">
                            <form action="<?= $login; ?>" method="POST" class="form-inline mt-0">
                                <div class="form-group mt-10">
                                    <div class="input-group AccountDD__InputGroup">
                                        <input type="text" class="form-control AccountDD__Input" name="email" placeholder="<?= $entry_email; ?>">
                                    </div>
                                    <div class="input-group AccountDD__InputGroup mt-10">
                                        <input type="password" class="form-control AccountDD__Input" name="password" placeholder="<?= $entry_password; ?>">
                                    </div>
                                </div>
                                <button type="submit" class="btn btn-dark mt-10 AccountDD__Button"><?= $text_login; ?></button>
                                <a class="AccountDD__Link mb-20" href="<?= $register; ?>"><?= $text_register; ?></a>
                            </form>
                        </div>
                        <style>
                            .AccountDD__Dropdown>#column-login{
                                width: 100% !important;
                            }
                        </style>

                        <?php echo $column_login; ?>
                        <? endif; ?>
                    </ul>
                </div>
                <?= $search; ?>
            </div>
        </div>
    </nav>
</div>
<?php } ?>
<!-- #mMenu -->
<nav id="mMenu" class="d-none">
    <ul id="panel-menu">
        <? $menuIndex=1; foreach ($categories as $category): ?>
        <li>
            <script>let hMenu<?= $menuIndex ?>="<?= str_replace('Telefon Kılıfı', '', $category ['name']); ?>";</script>
            <a href="<?= $category ['href']; ?>"
               onclick="dataLayerMenuClick(hMenu<?=$menuIndex++?>)"><?= str_replace('Telefon Kılıfı', '', $category ['name']); ?></a>
            <? if (0 < count ($category ['children'])): ?>
            <ul></ul>
            <? endif; ?>
        </li>
        <? endforeach; ?>
        <li>
            <a>Koleksiyonlar</a>
            <ul>
                <li>
                    <a href="/iphone-12-warner-bros-telefon-kilifi" class="text-center"
                       onclick="dataLayerMenuClick('DC X DeerCase Koleksiyonu')">
                        DC X DeerCase
                    </a>
                </li>
                <li>
                    <a href="/iphone-12-movies-series-telefon-kilifi" class="text-center"
                       onclick="dataLayerMenuClick('WB X DeerCase Koleksiyonu')">
                        WB X DeerCase
                    </a>
                </li>
                <li>
                    <a href="/iphone-x-seyma-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Şeyma X DeerCase Koleksiyonu')">
                        Şeyma X DeerCase
                    </a>
                </li>
                <li>
                    <a href="/iphone-11-pro-max-burcu-x-deercase-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Burcu X DeerCase Koleksiyonu')">
                        Burcu X DeerCase
                    </a>
                </li>
                <li>
                <li>
                    <a href="/iphone-11-pro-max-lansman-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Lansman Koleksiyonu')">
                        Lansman
                    </a>
                </li>
                <li>
                    <a href="/iphone-11-artycase-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('ArtyCase Koleksiyonu')">
                        ArtyCase
                    </a>
                </li>
                <li>
                    <a href="/iphone-12-slidecase-telefon-kilifi" class="text-center" onclick="dataLayerMenuClick('SlideCase Koleksiyonu')">
                        SlideCase
                    </a>
                </li>
                <li>
                    <a href="/iphone-11-pro-mermer-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Mermer Koleksiyonu')">
                        Mermer
                    </a>
                </li>
                <li>
                    <a href="/iphone-x-renkli-silikon-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Renkli Silikon Koleksiyonu')">
                        Renkli Silikon
                    </a>
                </li>
                <li>
                    <a href="/iphone-x-isme-ozel-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('İsmini Yaz Koleksiyonu')">
                        İsmini Yaz
                    </a>
                </li>
                <li>
                    <a href="/iphone-xs-max-neon-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Neon Koleksiyonu')">
                        Neon
                    </a>
                </li>
                <li>
                    <a href="/iphone-x-simli-sulu-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Simli Sulu Koleksiyonu')">
                        Simli Sulu
                    </a>
                </li>
                <li>
                    <a href="/iphone-xs-max-tutacakli-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Glossy Koleksiyonu')">
                        Glossy
                    </a>
                </li>
                <li>
                    <a href="/iphone-x-seffaf-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Şeffaf Koleksiyonu')">
                        Şeffaf
                    </a>
                </li>
                <li>
                    <a href="/iphone-x-harfli-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Alfabe Koleksiyonu')">
                        Alfabe
                    </a>
                </li>
                <li>
                    <a href="/iphone-x-retro-telefon-kiliflari" class="text-center"
                       onclick="dataLayerMenuClick('Retro Koleksiyonu')">
                        Retro
                    </a>
                </li>
            </ul>
        </li>
        <li><a href="/iphone-11-pro-max-kisiye-ozel-telefon-kiliflari"
               onclick="dataLayerMenuClick('<?= $text_customcase ?> Koleksiyonu')"><?= $text_customcase ?></a></li>
        <li><a href="/guestorder" onclick="dataLayerMenuClick('Siparişimi Sorgula')">Siparişimi
                Sorgula</a></li>
        <li><a href="/s-s-s" onclick="dataLayerMenuClick('S.S.S')">S.S.S</a></li>
    </ul>
    <ul id="panel-account">
        <? if ($logged): ?>
        <li><a href="<?= $account; ?>" onclick="dataLayerMenuClick('<?= $text_account; ?>')"><?= $text_account; ?></a>
        </li>
        <li><a href="<?= $wishlist; ?>" onclick="dataLayerMenuClick('Alışveriş Listem')">Alışveriş Listem</a></li>
        <li><a href="<?= $order; ?>" onclick="dataLayerMenuClick('Siparişlerim')">Siparişlerim</a></li>
        <li><a href="/address" onclick="dataLayerMenuClick('Adreslerim')">Adreslerim</a></li>
        <li><a href="<?= $logout; ?>" onclick="dataLayerMenuClick('<?= $text_logout; ?>')"><?= $text_logout; ?></a></li>
        <? else: ?>
        <li><a href="<?= $login; ?>" onclick="dataLayerMenuClick('<?= $text_login; ?>')"><?= $text_login; ?></a></li>
        <li><a href="<?= $register; ?>"
               onclick="dataLayerMenuClick('<?= $text_register; ?>')"><?= $text_register; ?></a></li>
        <? endif; ?>
    </ul>
</nav>
<script>
    var Categories = '';
    jQuery(function ($) {
        $('a[href="' + window.location.href + '"]').parent().addClass('active');
        // #mMenu && #mMenu-btn
        var $menu = $("#mMenu").mmenu();
        var $icon = $("#mMenu-btn");
        var API = $menu.data("mmenu");
        $icon.on("click", function () {
            API.open();
        });
        API.bind("open:finish", function () {
            $icon.addClass("is-active");
            setTimeout(function () {
                var iOpeningEffect = 0;
                var intervalOpeningEffect = setInterval(function () {
                    $(".mm-btn_next").toggleClass("--opening-effect");
                    if (0 < iOpeningEffect) clearInterval(intervalOpeningEffect);
                    else iOpeningEffect++;
                }, 500);
            }, 100);
        });
        API.bind("close:finish", function () {
            $icon.removeClass("is-active");
        });
        $('#mMenu').removeClass('d-none');
        /* kategori data header */
        // var Categories = ''; // <?php //json_encode ($categories) ?>

        $.get('/index.php?route=product/category/getJsonCategories', function (data) {
            Categories = JSON.parse(data);
        });

        $('.mm-btn_next').click (function () {
            var listview = $('#mm-' + ($(this).parent ().index () + 1)).find ('.mm-listview'), index = $(this).parent ().index ();
            if (listview.text ().trim () < 1) {
                $.each (Categories [index].children, function (Index, Category) {
                    listview.append(
                        '<li class="mm-listitem">' +
                        '<a href="' + Category ["href"] + '" class="mm-listitem__text">' + Category ['name'].replace(' Telefon Kılıfı', '') + '</a>' +
                        '</li>'
                    );
                });
            }
        });
    });
</script>
<!-- #mMenu -->

<!-- #dDMenu -->
<script>
    jQuery (function ($) {
        $('#dDMenu > .navbar-nav > .dropdown').hover (function () {
            var Element = this;
            if ($(Element).find ('ul').text ().trim () < 1) {
                $.each (Categories [$(Element).index ()].children, function (Index, Category) {
                    $(Element).find ('ul').append (
                        '<li>' +
                        '<a href="' + Category ["href"] + '" class="text-center" onclick="dataLayerMenuClick(\'' + Category ['name'].replace(' Telefon Kılıfı', '') + '\', \'header\')">' + Category ['name'].replace(' Telefon Kılıfı', '') + '</a>' +
                        '</li>'
                    );
                });
            }
        });
    });
</script>
<!-- #dDMenu -->