<?php require_once('header.php'); ?>

<section class="hidden-md hidden-lg">
             <div class="container">
                <div class="row ">
                    <?php
        				$statement = $this->db->query("SELECT * FROM tbl_mid_category order by mcat_id desc");
        				$result = $statement->result_array();
        				foreach ($result as $row1) {
        					?>
        				<div class="col-md-12 col-12 col-lg-12 mb-10">			
                            <div class="item2" id="mdi_<?=$row1['mcat_id'];?>" onclick="$('#Display_id_<?=$row1['mcat_id'];?>').toggle();$(this).toggleClass('mycolor');$('#mdi_<?=$row1['mcat_id'];?> .category-item2 .icon i').toggleClass('mdi-chevron-up');">
                                    <div class="category-item2">
                                        <div class="row">
                                        <div class="col-md-4  col-sm-4 col-4 "><img class="img-fluidx" style="height: auto;" src="<?=base_url('uploads/shop/mid_category/'.$row1['mcat_pic']); ?>" alt=""></div>
                                        <div class="col-md-6  col-sm-6 col-6 ">
                                            <div class="content">
                                                <span> <?=$row1['mcat_name']; ?></span>
                                                <p class="text2">
                                                    <?php
                                                        $mcatid = $row1['mcat_id'];
                										$statement = $this->db->query("SELECT * FROM tbl_end_category WHERE mcat_id=$mcatid");
                                                        $result2 = $statement->result_array();
                                                        foreach ($result2 as $row2) {
                											?>
                											<?=$row2['ecat_name']; ?>,
                                                    	<?php
                										}
                										?>
                                                </p>
                                        </div></div>
                                        <div class="col-md-2 col-sm-2 col-2 "><div class="icon"><i class="mdi mdi-chevron-right"></i></div></div>
                                        </div>
                                    </div>
                                    <div class="p-10 p-102" id="Display_id_<?=$row1['mcat_id'];?>" style="display:none;">
                                        <div class="row cat-all" >
                                            <div class="col-md-4 col-lg-3 col-xl-2 no-padding col-sm-4 col-4 text-center">
                                                <a href="product_special?id=<?=$row1['mcat_id']; ?>&type=mid-category&mid=<?=$row1['mcat_id']; ?>">
                                                <div class="category-item3">
                                                    <img class="img-fluid" src="<?=base_url('uploads/shop/mid_category/'.$row1['mcat_pic']); ?>" alt=""><br>All <?=$row1['mcat_name']; ?>
                                                </div>
                                                </a>
                                            </div>
                                        <?php
                										$mcat2id = $row1['mcat_id'];
                										$statement = $this->db->query("SELECT * FROM tbl_end_category WHERE mcat_id=$mcat2id");
                                                        $result2 = $statement->result_array();
                                                        foreach ($result2 as $row2) {
                                                            $pic='';
                                                            $arr_pic='';
                                                            $arr_pic = explode('.',$row2['ecat_pic']);
                                                            if(empty($arr_pic[1]) || !file_exists('uploads/shop/end_category/'.$row2['ecat_pic'])){
                                                            $pic='../../no-image.png';
                                                            }
                                                            else
                                                            {
                                                                $pic = $row2['ecat_pic'];
                                                            }
                											?>
                                                            <div class="col-md-4 col-lg-3 col-xl-2 no-padding col-sm-4 col-4 text-center">
                                                                <a href="product_special?id=<?=$row2['ecat_id']; ?>&type=end-category&mid=<?=$row1['mcat_id']; ?>">
                                                                <div class="category-item3">
                                                                    <img class="img-fluid" src="<?=base_url('uploads/shop/end_category/'.$pic); ?>" alt=""><br><?=$row2['ecat_name']; ?>
                                                                </div>
                                                                </a>
                                                            </div>
                                                    	<?php
                										}
                										?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
        			<?php
        				}
        			?>
                    
                    
                    </div>
                 </div>
          </section>

<?php require_once('footer.php'); ?>