<?php
$res = $this->db->query("SELECT * FROM wps_categories WHERE status = '1' AND parent_id = '0' limit 0,10")->result_array();
?>
<body class="cnt-home">
<!-- ============================================== HEADER ============================================== -->
<header class="header-style-1">
  <!-- ============================================== TOP MENU ============================================== -->
  <div class="top-bar animate-dropdown">
    <div class="container">
      <div class="header-top-inner">
        <div class="cnt-account">
          <ul class="list-unstyled">
            <?php
              if ($this->session->userdata('user_id') > 0) {
                ?>
            <li><a href="<?php echo site_url('members'); ?>">Welcome <?php echo $this->session->userdata('first_name'); ?></a></li>
            <li><a href="<?php echo site_url('members'); ?>"><i class="icon fa fa-user"></i>My Account</a></li>
            <li><a href="<?php echo site_url('users/logout'); ?>"><i class="icon fa fa-sign-out"></i>Logout</a></li>
            <?php
              } else {
                ?>
            <li><a href="<?php echo site_url('members'); ?>"><i class="icon fa fa-user"></i>My Account</a></li>
			<li><a href="#"><i class="icon fa fa-heart"></i>Wishlist</a></li>
            <li><a href="<?php echo site_url('register'); ?>"><i class="icon fa fa-lock"></i>Sign In/Register</a></li>
            <?php
              }
              ?>
          </ul>
        </div>
        <!-- /.cnt-account -->
        <div class="cnt-block">
          <ul class="list-unstyled list-inline">
            <!--<li class="dropdown dropdown-small"> <a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><span class="value">MZN </span></a> </li>-->
            <!--<li class="dropdown dropdown-small"> <a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><span class="value">Portuguese </span><b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="#">Portuguese</a></li>
                <li><a href="#">English</a></li>
              </ul>
            </li>-->
          </ul>
          <!-- /.list-unstyled -->
        </div>
        <!-- /.cnt-cart -->
        <div class="clearfix"></div>
      </div>
      <!-- /.header-top-inner -->
    </div>
    <!-- /.container -->
  </div>
  <!-- /.header-top -->
  <!-- ============================================== TOP MENU : END ============================================== -->
  <div class="main-header">
    <div class="container">
      <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-3 logo-holder">
          <!-- ============================================================= LOGO ============================================================= -->
          <div class="logo"> <a href="<?php echo site_url(); ?>"> <img src="<?php echo theme_url(); ?>images/logo.png" alt="logo"> </a> </div>
          <!-- /.logo -->
          <!-- ============================================================= LOGO : END ============================================================= -->
        </div>
        <!-- /.logo-holder -->
        <div class="col-xs-12 col-sm-12 col-md-7 top-search-holder">
          <!-- /.contact-row -->
          <!-- ============================================================= SEARCH AREA ============================================================= -->
          <div class="search-area">
            <form>
              <div class="control-group">
                <ul class="categories-filter animate-dropdown">
                  <li class="dropdown"> <a class="dropdown-toggle"  data-toggle="dropdown" href="">Categories <b class="caret"></b></a>
                    <ul class="dropdown-menu" role="menu" >
                      <li role="presentation"><a role="menuitem" tabindex="-1" href="">- Grocery</a></li>
                      <li role="presentation"><a role="menuitem" tabindex="-1" href="">- Home Appliances </a></li>
                      <li role="presentation"><a role="menuitem" tabindex="-1" href="">- Dairy & Frozen </a></li>
                      <li role="presentation"><a role="menuitem" tabindex="-1" href="">- Furniture</a></li>
                      <li role="presentation"><a role="menuitem" tabindex="-1" href="">- Crockery</a></li>
                      <li role="presentation"><a role="menuitem" tabindex="-1" href="">- Plastic Materials </a></li>
                      <li role="presentation"><a role="menuitem" tabindex="-1" href="">- Personal Care </a></li>
                      <li role="presentation"><a role="menuitem" tabindex="-1" href="">- Steel and Roofing Products</a></li>
                    </ul>
                  </li>
                </ul>
                <input class="search-field" placeholder="Search here..." />
                <a class="search-button" href="#" ></a> </div>
            </form>
          </div>
          <!-- /.search-area -->
          <!-- ============================================================= SEARCH AREA : END ============================================================= -->
        </div>
        <!-- /.top-search-holder -->
        <div class="col-xs-12 col-sm-12 col-md-2 animate-dropdown top-cart-row">
          <!-- ============================================================= SHOPPING CART DROPDOWN ============================================================= -->
		  
          <div class="dropdown dropdown-cart"> <a href="#" class="dropdown-toggle lnk-cart" data-toggle="dropdown">
            <div class="items-cart-inner">
              <div class="basket"> <i class="glyphicon glyphicon-shopping-cart"></i> </div>
              <div class="basket-item-count"><span class="count">2</span></div>
              <div class="total-price-basket"> <span class="lbl">cart -</span> <span class="total-price"> <span class="sign">MZN</span> <span class="value">600</span> </span> </div>
            </div>
            </a>
            <ul class="dropdown-menu">
              <li>
                <div class="cart-item product-summary">
                  <div class="row">
                    <div class="col-xs-4">
                      <div class="image"> <a href=""><img src="<?php echo theme_url(); ?>images/cart.jpg" alt=""></a> </div>
                    </div>
                    <div class="col-xs-7">
                      <h3 class="name"><a href="index.php?page-detail">Simple Product</a></h3>
                      <div class="price">MZN600.00</div>
                    </div>
                    <div class="col-xs-1 action"> <a href="#"><i class="fa fa-trash"></i></a> </div>
                  </div>
                </div>
                <!-- /.cart-item -->
                <div class="clearfix"></div>
                <hr>
                <div class="clearfix cart-total">
                  <div class="pull-right"> <span class="text">Sub Total :</span><span class='price'>MZN600.00</span> </div>
                  <div class="clearfix"></div>
                  <a href="" class="btn btn-upper btn-primary btn-block m-t-20">Checkout</a> </div>
                <!-- /.cart-total-->
              </li>
            </ul>
            <!-- /.dropdown-menu-->
          </div>
          <!-- /.dropdown-cart -->
          <!-- ============================================================= SHOPPING CART DROPDOWN : END============================================================= -->
        </div>
        <!-- /.top-cart-row -->
      </div>
      <!-- /.row -->
    </div>
    <!-- /.container -->
  </div>
  <!-- /.main-header -->
  <!-- ============================================== NAVBAR ============================================== -->
  <div class="header-nav animate-dropdown">
    <div class="container">
      <div class="yamm navbar navbar-default" role="navigation">
        <div class="navbar-header">
          <button data-target="#mc-horizontal-menu-collapse" data-toggle="collapse" class="navbar-toggle collapsed" type="button"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
        </div>
        <div class="nav-bg-class">
          <div class="navbar-collapse collapse" id="mc-horizontal-menu-collapse">
            <div class="nav-outer">
              <ul class="nav navbar-nav">
                <li class="active dropdown yamm-fw"> <a href="<?php echo site_url(); ?>" data-hover="dropdown" class="dropdown-toggle" data-toggle="dropdown">Home</a> </li>

				<?php
                    if (is_array($res) && !empty($res)) {
                      $slmenu = 1;
                      foreach ($res as $key => $val) {
					  $catsRes = $this->db->query("SELECT category_id, category_name, category_image, friendly_url FROM wps_categories WHERE status = '1' AND parent_id = '" . $val['category_id'] . "' ORDER BY home_menu")->result_array();
                          ?>
                <li <?php echo (is_array($catsRes) && !empty($catsRes))?'class="dropdown mega-menu"':''; ?>> <a href="<?php echo site_url($val['friendly_url']); ?>" <?php echo (is_array($catsRes) && !empty($catsRes))?'data-hover="dropdown" data-toggle="dropdown"':'';?>><?php echo $val['category_name']; ?> <span class="menu-label hot-menu hidden-xs">hot</span> </a>
				<?php
                            if (is_array($catsRes) && !empty($catsRes)) {
                              ?>
                  <ul class="dropdown-menu container">
                    <li>
                      <div class="yamm-content">
                        <div class="row">
						 <?php
                                $cnt=1;
                                foreach ($catsRes as $key1 => $pageVal) {
                             
							      ?>
                          <div class="col-xs-12 col-sm-12 col-md-2 col-menu">
                            <h2 class="title"><a href="<?php echo site_url($pageVal['friendly_url']); ?>"><?php echo $pageVal['category_name']; ?></a></h2>
                            <ul class="links">
							 
                              <li><a href="#">Demo</a></li>
							  
                            </ul>
                          </div>
						 <?php
                                  $cnt++;
                                }
                                ?>
							  
								
                          <div class="col-xs-12 col-sm-12 col-md-6 col-menu custom-banner"> <a href="<?php echo site_url($pageVal['friendly_url']); ?>"><img alt="" src="<?php echo get_image('category', $pageVal['category_image'], '535', '250', 'R'); ?>"></a> 
						  
						  </div>
                        </div>
                      </div>
                    </li>
                  </ul>
				  
				  <?
				  }
				  ?>
                </li>
				 <?php
                        //}
                        $slmenu++;
                      }
                    }
                    ?>

               
                
              </ul>
              <!-- /.navbar-nav -->
              <div class="clearfix"></div>
            </div>
            <!-- /.nav-outer -->
          </div>
          <!-- /.navbar-collapse -->
        </div>
        <!-- /.nav-bg-class -->
      </div>
      <!-- /.navbar-default -->
    </div>
    <!-- /.container-class -->
  </div>
  <!-- /.header-nav -->
  <!-- ============================================== NAVBAR : END ============================================== -->
</header>
