<?php
	include('header.php');
	
	if($_SESSION['kkks']==2)
	{
	?>
<script>
window.localStorage.removeItem('kush');
</script>	
	
	<?php
	}
  if(isset($_SESSION['customer']['uid'])){
        if($_SESSION['customer']['uid']!='')
            {
            ?>                
                 <script>
                    window.localStorage.setItem('kush','<?php echo $_SESSION['customer']['uid']; ?>');
                      
                 </script>              
                 <?php
            }
  }
         
            if($_SESSION['customer']['uid']=='')
            {
                if($_SESSION['kkks']!=1)
                {
                    ?>
                         <script>
                         if(window.localStorage.getItem('kush')){
                            document.write("<form method='post' action='<?=base_url("Login/verifys");?>' id='LOCAL_USER'><input name='kush' type='hidden' value='"+window.localStorage.getItem('kush')+"'></form>");
                           document.getElementById("LOCAL_USER").submit();    
                         }
                         </script>
                 <?php 
             }
            }
         ?>
         
 <style>
  .news-ticker {
    background-color: #ffc107;
    color: #000;
    padding: 10px 0;
    overflow: hidden;
    position: relative;
    white-space: nowrap;
  }

  .ticker-move {
    display: inline-block;
    white-space: nowrap;
    animation: scroll-left 30s linear infinite;
  }

  @keyframes scroll-left {
    0% {
      transform: translateX(0);
    }
    100% {
      transform: translateX(-50%);
    }
  }
</style>

<div class="news-ticker">
  <div class="ticker-move">
    <?php
    $this->db->where('status', 1);
    $news = $this->db->get('tbl_photo2')->result_array();
    foreach ($news as $r) {
      echo '📢 ' . $r['link'] . ' &nbsp;&nbsp;&nbsp;&nbsp;';
    }
   
    ?>
  </div>
</div>


         
<div id="home_slider" class="carousel slide" data-bs-ride="carousel">
	<div class="carousel-indicators d-none d-md-flex d-lg-flex">
		<?php
			if(!empty($slider)){
			    $i=0;
			    foreach($slider as $row){
			?>
		<li data-bs-target="#home_slider" data-bs-slide-to="<?=$i;?>" <?=($i==1) ? ' class="active"  aria-current="true"' : '' ;?>></li>
		<?php
			$i++;
			}
			}
			?>
	</div>
	<div class="carousel-inner">
		<?php
			if(!empty($slider)){
			    $i=0;
			    foreach($slider as $row){
			        $i++;
			?>
		<div class="carousel-item <?=($i==1) ? 'active' : '' ;?>">
			<img src="<?=base_url('uploads/shop/slider/'.$row['photo']);?>" alt="<?=$row['title'];?>" title="<?=$row['title'];?>" class="d-block w-100">
		</div>
		<?php 
			}
			}
			?>
			
			
			
			
			
	</div>
	<button class="carousel-control-prev" type="button" data-bs-target="#home_slider" data-bs-slide="prev">
	<i class="icofont-arrow-left bamdik2"></i>
	</button>
	<button class="carousel-control-next" type="button" data-bs-target="#home_slider" data-bs-slide="next">
	<i class="icofont-arrow-right bamdik2"></i>
	</button>
</div>

<section class="section suggest-part my-3">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <div class="section-heading mb-2">
                    <h2>Shop from New Top Categories <?php  echo $_SESSION['kkks'];  ?></h2>
                </div>
            </div>
        </div>
    <div class="p-3">
        <div class="row mb-10 justify-content-center">
            <?php
                if(isset($mid_category)){
                foreach ($mid_category as $row1) {
			?>
            <div class="product-layout p-0-5-5-0 col-3 col-lg-2 col-md-3 col-sm-3 ">
                <!--<div class="product-thumb transition p-1">-->
                    <div class="image bg-white pt-1 shadow-sm">
                        <a href="product_special?id=<?=$row1['mcat_id']; ?>&amp;type=mid-category&amp;mid=<?=$row1['mcat_id']; ?>" class="px-3">
                            <img src="<?= base_url('uploads/shop/mid_category/'.$row1['mcat_pic']); ?>" alt="<?=$row1['mcat_name']; ?>" title="<?=$row1['mcat_name']; ?>" class="img-fluid rounded-circle w-60">
                        </a>
                        <b class="d-block w-100 text-center"><a href="product_special?id=<?=$row1['mcat_id']; ?>&amp;type=mid-category&amp;mid=<?=$row1['mcat_id']; ?>" class="text-dark " style="font-size:12px;"><?=$row1['mcat_name']; ?></a></b>
                    </div>
                <!--</div>-->
            </div>
            <?php
                }
                }
            ?>
        </div>
    </div>
    </div>
</section>
    


<section class="section newitem-part">
	<div class="container">
		<div class="row">
			<div class="col">
				<div class="section-heading">
					<h2>todays Best Deal</h2>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<div class="owl-carousel owl-carousel-featured">
					<?php
                        $p_old_price = 0;$p_current_price = 0;$p_qty = 0;$size_id = 0;$size_name = 0;$color_name = 0;$l = 0;$p_pv = 0;
                        $query11 = $this->db->query('select * from tbl_product where p_is_active=1 and  todays_best_deal=1 order by p_id limit 10');
                        if(count($query11->result_array())){
                            foreach ($query11->result_array() as $row) {
                    ?>
							<div class="item " loading="lazy" id="pid_2_<?=$row['p_id']; ?>">
								<div class="product-card" id="out_of_stock_<?=$row['p_id']; ?>">
									<div class="product-media">
										
										<div class="product-label">
											<label class="label-text new"><span class="badge badge-success" <?='id="offer_' .$row[ 'p_id']. '"'; ?> >0 % OFF</span></label>
										</div>
										<!--<button class="product-wish wish"><i class="fas fa-heart"></i></button> -->
										<a class="product-image" href="<?=base_url('product_view');?>?id=<?=$row['p_id']; ?>">
								    <img id="pic_<?=$row['p_id']; ?>" src="<?=base_url('uploads/shop/product/'.$row['p_featured_photo']); ?>" alt="<?=$row['p_name']; ?>">
								    <input type="hidden" id="pic2_<?=$row['p_id']; ?>" value="<?= $row['p_featured_photo']; ?>" />
								</a>
										<!--<div class="product-widget"><a title="Product Compare" href="compare.php" class="fas fa-random"></a><a title="Product Video" href="https://youtu.be/9xzcVxSBbG8" class="venobox fas fa-play" data-autoplay="true" data-vbtype="video"></a><a title="Product View" href="#" class="fas fa-eye" data-bs-toggle="modal" data-bs-target="#product-view"></a></div>--></div>
									<div class="product-content">
										<!--<div class="product-rating"><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="icofont-star"></i><a href="product-video.php">(3)</a></div>-->
										<h6 class="product-name"><a href="<?=base_url('product_view');?>?id=<?=$row['p_id']; ?>"><?=$row['p_name']; ?></a></h6>
										<?php
										
                                        $i=1;
                                        $pid=$row['p_id'];
                                        
                                        $query_product_size = $this->db->query("select * from tbl_product_size where p_id = $pid");
                                        foreach ($query_product_size->result_array() as $row2) {
                                            
                                            $p_pv = $row2['p_pv'];
                                            $size_id = $row2['size_id'];
                                            $color_id = $row2['color_id'];
                                            $p_old_price = $row2['p_old_price'];
                                            $p_current_price = $row2['p_current_price'];
                                            $p_qty = $row2['p_qty'];
                                            
                                            if(empty($color_id)){
                                                $color_id='';
                                                $color_name = '';
                                            }
                                            else
                                            {
                                                $query4 = $this->db->query("select * from tbl_color where color_id = $color_id ");
                                                if($query4->num_rows() > 0){
                                                    foreach ($query4->result_array() as $row4) {
                                                        $color_name = $row4['color_name'];
                                                    }
                                                }
                                            }
                                                    
                                            $query3 = $this->db->query("select * from tbl_size where size_id = $size_id ");
                                            if($query3->num_rows() > 0){
                                                foreach ($query3->result_array() as $row3) {
                                                        $size_name = $row3['size_name'];
                                                }
                                            }
                                            if($i==1){
                                                ?>
                                            <input type="hidden" id="p_current_price_<?=$row['p_id']; ?>" value="<?=$p_current_price; ?>">
                                            <input type="hidden" id="p_old_price_<?=$row['p_id']; ?>" value="<?=$p_old_price; ?>">
                                            <input type="hidden" id="p_name_<?=$row['p_id']; ?>" value="<?=$row['p_name']; ?>">
                                            <input type="hidden" id="size_id_<?=$row['p_id']; ?>" value="<?=$size_id; ?>">
                                            <input type="hidden" id="color_id_<?=$row['p_id']; ?>" value="<?=$color_id; ?>">
                                            <input type="hidden" id="p_pv_<?=$row['p_id']; ?>" value="<?=$p_pv; ?>">
                                            <input type="hidden" id="color_name_<?=$row['p_id']; ?>" value="<?=$color_name; ?>">
                                            <input type="hidden" id="size_name_<?=$row['p_id']; ?>" value="<?=$size_name; ?>">
                                            <input type="hidden" id="p_featured_photo_<?=$row['p_id']; ?>" value="<?= $row['p_featured_photo']; ?>">
											<div class="input-group">
												<input id="size2_<?=$row['p_id']; ?>" id2="<?=$row['p_id']; ?>"
												onclick="check_size(<?=$row['p_id']; ?>);" class="form-control px-2 input-check-size" 
												value="<?=$row3['size_name'];?> <?php if(empty($color_name)){}else{?>(<?=$color_name;?>)<?php } ?>" readonly>
												<div class="input-group-addon p-2 check-size-btn"> <i class="fa fa-bars"></i> </div>
											</div>
											
											<input type="hidden" id="size_<?=$row['p_id']; ?>" class="form_value" value="<?=$size_id; ?>,<?=$p_old_price;?>,<?=$p_current_price;?>,<?=$p_qty;?>,<?=$size_name;?>,<?=$row['p_id']; ?>,<?=$color_id; ?>,<?=$color_name; ?>,<?=$p_pv;?>" id2="<?=$row['p_id']; ?>" />
											<?php
											
                                                }
                                                $i++;
                                            }
                                            ?>
								<h6 class="product-price">
									<del><?php if($p_old_price!='' && $p_old_price!=$p_current_price){?><span class="regular-price"><?=$data['currency'];?><b id="price_o_<?=$row['p_id']; ?>"><?=$p_old_price; ?></b></span><?php } ?></del>
									<span><b id="price_c_<?=$row['p_id']; ?>"><?=$data['currency'];?><?=$p_current_price; ?></b> <b class="pv d-none">(<b id="p_pv2_<?=$row['p_id']; ?>"><?=$p_pv;?></b> PV)</b></span>
								</h6>
								<!--Product Size start-->
                                    <?php
                                                $count=0; 
                                                $query21 = $this->db->query("select * from tbl_product_size where p_id = $pid");
                                                foreach ($query21->result_array() as $row2) {
                                                    $primary_id=0; $count++; $primary_id = $row['p_id'].$row2['size_id'].$row2['color_id'];
                                                    ?>
                                                    <button class="product-wish wish wish2" id="wish_hide_A<?=$primary_id; ?>" onclick="add_to_wishlist(<?=$row['p_id'].','.$primary_id; ?>)"><i class="fas fa-heart"></i></button>
                                                <?php
                                                    if($row2['p_qty'] != 0){
                                                ?>
                                                
                                                    <div class="product-action" id2="yes1" id3="<?=$count;?>" id="hide_A<?=$primary_id; ?>" style="display:none">
                                                        <button class="action-minus" title="Quantity Minus" onclick="minus(<?=$row['p_id'].','.$primary_id; ?>)"><i class="icofont-minus"></i></button>
                                                        <input class="action-input" title="Quantity Number" readonly name="quantity" qty_id="<?=$l;?>" id="qty_<?=$primary_id; ?>" qty="<?=$row2['p_qty']; ?>" value="1">
                                                        <button class="action-plus" title="Quantity Plus" onclick="plus(<?=$row['p_id'].','.$primary_id; ?>)"><i class="icofont-plus"></i></button>
                                                    </div>
                                                    <input id="qty2_<?=$primary_id; ?>" qty="<?=$row2['p_qty']; ?>" type="hidden" value="1" />
                                                    <button class="product-add" title="Add to Cart" id2="no1" id3="<?=$count;?>" id="hide_B<?=$primary_id; ?>" onclick="add(<?=$row['p_id'].','.$primary_id; ?>)"><i class="fas fa-shopping-basket"></i><span>add to cart</span></button>
    										<?php
                                                    }
                                                    else if($row2['p_qty'] == 0 || $row2['p_qty'] < 0)
                                                    {
                                            ?>
                                                    <button class="product-add bg-warning" title="Out Of Stock" id2="no1" id3="<?=$count;?>" id="hide_B<?=$primary_id; ?>" onclick="sweetalert('warning','Out Of Stock')"><i class="fas fa-shopping-basket"></i><span>Out Of Stock</span></button>
    								            <?php
                                                    }
                                                }
                                                ?>
										<!--Product Size end-->
									</div>
								</div>
							</div>
							<?php }
                        } else {
                            ?>
                            <div class="item" loading="lazy">
								<div class="col-md-12 text-center"> <img src="<?=base_url('uploads/no_product_found.png');?>" class="img-fluid" /> </div>
							</div>
						<?php
                        }
                        ?>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<div class="section-btn-25"><a href="<?=base_url('today_deal');?>" class="btn btn-outline"><i class="fas fa-eye"></i><span>show more</span></a></div>
			</div>
		</div>
	</div>
</section>

<div class="section promo-part" style="margin-top:-50px;">
	<div class="container">
		<div class="row">
		    <?php
                    $u=0;
                    $query = $this->db->query("SELECT * FROM tbl_ad_slider ORDER BY RAND() limit 2");
                    foreach ($query->result_array() as $row) {
        		?>
			<div class="col-sm-12 col-md-6 col-lg-6 px-xl-3 <?php if($u==0){echo 'd-none d-lg-block d-md-block d-sm-block';}?>">
				<div class="promo-img"><a href="<?=$row['link']; ?>"><img src="<?= base_url('uploads/shop/ad_slider/'.$row['img']); ?>" class="w-100" alt="<?=$row['title']; ?>"></a></div>
			</div>
			<?php
			        $u++;
                        }
			?>
		</div>
	</div>
</div>


<section class="section recent-part " style="margin-top:-50px;">
	<div class="container">
		<div class="row">
			<div class="col-lg-12">
				<div class="section-heading">
					<h2>Latest items</h2>
				</div>
			</div>
		</div>
		<div class="row row-cols-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5" style="margin-top:-50px;">
            <?php
                        $p_old_price = 0;$p_current_price = 0;$p_qty = 0;$size_id = 0;$size_name = 0;$color_name = 0;$l = 0;
                        $query11 = $this->db->query('select * from tbl_product where p_is_active=1 and p_is_featured!=1 and todays_best_deal!=1 order by p_id limit 5');
                        if(count($query11->result_array())){
                            foreach ($query11->result_array() as $row) {
                    ?>
							<div class="col mt-5  mb-10 item" loading="lazy" id="pid_2_<?=$row['p_id']; ?>">
								<div class="product-card" id="out_of_stock_<?=$row['p_id']; ?>">
									<div class="product-media">
										<div class="product-label">
											<label class="label-text new"><span class="badge badge-success" <?='id="offer_' .$row[ 'p_id']. '"'; ?> >0 % OFF</span></label>
										</div>
										<!--<button class="product-wish wish"><i class="fas fa-heart"></i></button> -->
										<a class="product-image" href="<?=base_url('product_view');?>?id=<?=$row['p_id']; ?>">
								    <img id="pic_<?=$row['p_id']; ?>" src="<?=base_url('uploads/shop/product/'.$row['p_featured_photo']); ?>" alt="<?=$row['p_name']; ?>">
								    <input type="hidden" id="pic2_<?=$row['p_id']; ?>" value="<?= $row['p_featured_photo']; ?>" />
								</a>
										<!--<div class="product-widget"><a title="Product Compare" href="compare.php" class="fas fa-random"></a><a title="Product Video" href="https://youtu.be/9xzcVxSBbG8" class="venobox fas fa-play" data-autoplay="true" data-vbtype="video"></a><a title="Product View" href="#" class="fas fa-eye" data-bs-toggle="modal" data-bs-target="#product-view"></a></div>--></div>
									<div class="product-content">
										<!--<div class="product-rating"><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="icofont-star"></i><a href="product-video.php">(3)</a></div>-->
										<h6 class="product-name"><a href="<?=base_url('product_view');?>?id=<?=$row['p_id']; ?>"><?=$row['p_name']; ?></a></h6>
										<?php
										
                                        $i=1;
                                        $pid=$row['p_id'];
                                        
                                        $query_product_size = $this->db->query("select * from tbl_product_size where p_id = $pid");
                                        foreach ($query_product_size->result_array() as $row2) {
                                            
                                            $p_pv = $row2['p_pv'];
                                            $size_id = $row2['size_id'];
                                            $color_id = $row2['color_id'];
                                            $p_old_price = $row2['p_old_price'];
                                            $p_current_price = $row2['p_current_price'];
                                            $p_qty = $row2['p_qty'];
                                            
                                            if(empty($color_id)){
                                                $color_id='';
                                                $color_name = '';
                                            }
                                            else
                                            {
                                                $query4 = $this->db->query("select * from tbl_color where color_id = $color_id ");
                                                if($query4->num_rows() > 0){
                                                    foreach ($query4->result_array() as $row4) {
                                                        $color_name = $row4['color_name'];
                                                    }
                                                }
                                            }
                                                    
                                            $query3 = $this->db->query("select * from tbl_size where size_id = $size_id ");
                                            if($query3->num_rows() > 0){
                                                foreach ($query3->result_array() as $row3) {
                                                        $size_name = $row3['size_name'];
                                                }
                                            }
                                            if($i==1){
                                                ?>
                                            <input type="hidden" id="p_current_price_<?=$row['p_id']; ?>" value="<?=$p_current_price; ?>">
                                            <input type="hidden" id="p_old_price_<?=$row['p_id']; ?>" value="<?=$p_old_price; ?>">
                                            <input type="hidden" id="p_name_<?=$row['p_id']; ?>" value="<?=$row['p_name']; ?>">
                                            <input type="hidden" id="size_id_<?=$row['p_id']; ?>" value="<?=$size_id; ?>">
                                            <input type="hidden" id="color_id_<?=$row['p_id']; ?>" value="<?=$color_id; ?>">
                                            <input type="hidden" id="p_pv_<?=$row['p_id']; ?>" value="<?=$p_pv; ?>">
                                            <input type="hidden" id="color_name_<?=$row['p_id']; ?>" value="<?=$color_name; ?>">
                                            <input type="hidden" id="size_name_<?=$row['p_id']; ?>" value="<?=$size_name; ?>">
                                            <input type="hidden" id="p_featured_photo_<?=$row['p_id']; ?>" value="<?= $row['p_featured_photo']; ?>">
											<div class="input-group">
												<input id="size2_<?=$row['p_id']; ?>" id2="<?=$row['p_id']; ?>"
												onclick="check_size(<?=$row['p_id']; ?>);" class="form-control px-2 input-check-size" 
												value="<?=$row3['size_name'];?> <?php if(empty($color_name)){}else{?>(<?=$color_name;?>)<?php } ?>" readonly>
												<div class="input-group-addon p-2 check-size-btn"> <i class="fa fa-bars"></i> </div>
											</div>
											
											<input type="hidden" id="size_<?=$row['p_id']; ?>" class="form_value" value="<?=$size_id; ?>,<?=$p_old_price;?>,<?=$p_current_price;?>,<?=$p_qty;?>,<?=$size_name;?>,<?=$row['p_id']; ?>,<?=$color_id; ?>,<?=$color_name; ?>,<?=$p_pv;?>" id2="<?=$row['p_id']; ?>" />
											<?php
											
                                                }
                                                $i++;
                                            }
                                            ?>
								<h6 class="product-price">
									<del><?php if($p_old_price!='' && $p_old_price!=$p_current_price){?><span class="regular-price"><?=$data['currency'];?><b id="price_o_<?=$row['p_id']; ?>"><?=$p_old_price; ?></b></span><?php } ?></del>
									<span><b id="price_c_<?=$row['p_id']; ?>"><?=$data['currency'];?><?=$p_current_price; ?></b> <b class="pv d-none">(<b id="p_pv2_<?=$row['p_id']; ?>"><?=$p_pv;?></b> PV)</b></span>
								</h6>
								<!--Product Size start-->
                                    <?php
                                                $count=0; 
                                                $query21 = $this->db->query("select * from tbl_product_size where p_id = $pid");
                                                foreach ($query21->result_array() as $row2) {
                                                    $primary_id=0; $count++; $primary_id = $row['p_id'].$row2['size_id'].$row2['color_id'];
                                                    ?>
                                                    <button class="product-wish wish wish2" id="wish_hide_A<?=$primary_id; ?>" onclick="add_to_wishlist(<?=$row['p_id'].','.$primary_id; ?>)"><i class="fas fa-heart"></i></button>
                                                <?php
                                                    if($row2['p_qty'] != 0){
                                                ?>
                                                
                                                    <div class="product-action" id2="yes1" id3="<?=$count;?>" id="hide_A<?=$primary_id; ?>" style="display:none">
                                                        <button class="action-minus" title="Quantity Minus" onclick="minus(<?=$row['p_id'].','.$primary_id; ?>)"><i class="icofont-minus"></i></button>
                                                        <input class="action-input" title="Quantity Number" readonly name="quantity" qty_id="<?=$l;?>" id="qty_<?=$primary_id; ?>" qty="<?=$row2['p_qty']; ?>" value="1">
                                                        <button class="action-plus" title="Quantity Plus" onclick="plus(<?=$row['p_id'].','.$primary_id; ?>)"><i class="icofont-plus"></i></button>
                                                    </div>
                                                    <input id="qty2_<?=$primary_id; ?>" qty="<?=$row2['p_qty']; ?>" type="hidden" value="1" />
                                                    <button class="product-add" title="Add to Cart" id2="no1" id3="<?=$count;?>" id="hide_B<?=$primary_id; ?>" onclick="add(<?=$row['p_id'].','.$primary_id; ?>)"><i class="fas fa-shopping-basket"></i><span>add to cart</span></button>
    										<?php
                                                    }
                                                    else if($row2['p_qty'] == 0 || $row2['p_qty'] < 0)
                                                    {
                                            ?>
                                                    <button class="product-add bg-warning" title="Out Of Stock" id2="no1" id3="<?=$count;?>" id="hide_B<?=$primary_id; ?>" onclick="sweetalert('warning','Out Of Stock')"><i class="fas fa-shopping-basket"></i><span>Out Of Stock</span></button>
    								            <?php
                                                    }
                                                }
                                                ?>
										<!--Product Size end-->
									</div>
								</div>
							</div>
							<?php }
                        } else {
                            ?>
                            </div>
        <div class="row">
			<div class="col-md-12 text-center"> <img src="<?=base_url('uploads/no_product_found.png');?>" class="img-fluid w-25" /> </div>
        		<?php
            }
            ?>
        </div>
		<div class="row">
			<div class="col-lg-12">
				<div class="section-btn-25"><a href="<?=base_url('latest');?>" class="btn btn-outline"><i class="fas fa-eye"></i><span>show more</span></a></div>
			</div>
		</div>
	</div>
</section>

<div class="section promo-part" style="margin-top:-50px;">
	<div class="container">
		<div class="row">
		    <?php
                    $u=0;
                    $query = $this->db->query("SELECT * FROM tbl_ad_slider ORDER BY RAND() limit 2");
                    foreach ($query->result_array() as $row) {
        		?>
			<div class="col-sm-12 col-md-6 col-lg-6 px-xl-3 <?php if($u==0){echo 'd-none d-lg-block d-md-block d-sm-block';}?>">
				<div class="promo-img"><a href="<?=$row['link']; ?>"><img src="<?= base_url('uploads/shop/ad_slider/'.$row['img']); ?>" class="w-100" alt="<?=$row['title']; ?>"></a></div>
			</div>
			<?php
			        $u++;
                        }
			?>
		</div>
	</div>
</div>

<section class="section newitem-part" style="margin-top:-70px;">
	<div class="container">
		<div class="row">
			<div class="col">
				<div class="section-heading">
					<h2>Featured new items</h2>
				</div>
			</div>
		</div>
		
		<div class="row">
			<div class="col">
				<div class="owl-carousel owl-carousel-featured">
					<?php
                        $p_old_price = 0;$p_current_price = 0;$p_qty = 0;$size_id = 0;$size_name = 0;$color_name = 0;$l = 0;
                        $query11 = $this->db->query('select * from tbl_product where p_is_active=1 and  p_is_featured=1 order by p_id limit 10');
                        if(count($query11->result_array())){
                            foreach ($query11->result_array() as $row) {
                    ?>
							<div class="item" loading="lazy" id="pid_2_<?=$row['p_id']; ?>">
								<div class="product-card" id="out_of_stock_<?=$row['p_id']; ?>">
									<div class="product-media">
										<div class="product-label">
											<label class="label-text new"><span class="badge badge-success" <?='id="offer_' .$row[ 'p_id']. '"'; ?> >0 % OFF</span></label>
										</div>
										<!--<button class="product-wish wish"><i class="fas fa-heart"></i></button> -->
										<a class="product-image" href="<?=base_url('product_view');?>?id=<?=$row['p_id']; ?>">
								    <img id="pic_<?=$row['p_id']; ?>" src="<?=base_url('uploads/shop/product/'.$row['p_featured_photo']); ?>" alt="<?=$row['p_name']; ?>">
								    <input type="hidden" id="pic2_<?=$row['p_id']; ?>" value="<?= $row['p_featured_photo']; ?>" />
								</a>
										<!--<div class="product-widget"><a title="Product Compare" href="compare.php" class="fas fa-random"></a><a title="Product Video" href="https://youtu.be/9xzcVxSBbG8" class="venobox fas fa-play" data-autoplay="true" data-vbtype="video"></a><a title="Product View" href="#" class="fas fa-eye" data-bs-toggle="modal" data-bs-target="#product-view"></a></div>--></div>
									<div class="product-content">
										<!--<div class="product-rating"><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="icofont-star"></i><a href="product-video.php">(3)</a></div>-->
										<h6 class="product-name"><a href="<?=base_url('product_view');?>?id=<?=$row['p_id']; ?>"><?=$row['p_name']; ?></a></h6>
										<?php
										
                                        $i=1;
                                        $pid=$row['p_id'];
                                        
                                        $query_product_size = $this->db->query("select * from tbl_product_size where p_id = $pid");
                                        foreach ($query_product_size->result_array() as $row2) {
                                            
                                            $p_pv = $row2['p_pv'];
                                            $size_id = $row2['size_id'];
                                            $color_id = $row2['color_id'];
                                            $p_old_price = $row2['p_old_price'];
                                            $p_current_price = $row2['p_current_price'];
                                            $p_qty = $row2['p_qty'];
                                            
                                            if(empty($color_id)){
                                                $color_id='';
                                                $color_name = '';
                                            }
                                            else
                                            {
                                                $query4 = $this->db->query("select * from tbl_color where color_id = $color_id ");
                                                if($query4->num_rows() > 0){
                                                    foreach ($query4->result_array() as $row4) {
                                                        $color_name = $row4['color_name'];
                                                    }
                                                }
                                            }
                                                    
                                            $query3 = $this->db->query("select * from tbl_size where size_id = $size_id ");
                                            if($query3->num_rows() > 0){
                                                foreach ($query3->result_array() as $row3) {
                                                        $size_name = $row3['size_name'];
                                                }
                                            }
                                            if($i==1){
                                                ?>
                                            <input type="hidden" id="p_current_price_<?=$row['p_id']; ?>" value="<?=$p_current_price; ?>">
                                            <input type="hidden" id="p_old_price_<?=$row['p_id']; ?>" value="<?=$p_old_price; ?>">
                                            <input type="hidden" id="p_name_<?=$row['p_id']; ?>" value="<?=$row['p_name']; ?>">
                                            <input type="hidden" id="size_id_<?=$row['p_id']; ?>" value="<?=$size_id; ?>">
                                            <input type="hidden" id="color_id_<?=$row['p_id']; ?>" value="<?=$color_id; ?>">
                                            <input type="hidden" id="p_pv_<?=$row['p_id']; ?>" value="<?=$p_pv; ?>">
                                            <input type="hidden" id="color_name_<?=$row['p_id']; ?>" value="<?=$color_name; ?>">
                                            <input type="hidden" id="size_name_<?=$row['p_id']; ?>" value="<?=$size_name; ?>">
                                            <input type="hidden" id="p_featured_photo_<?=$row['p_id']; ?>" value="<?= $row['p_featured_photo']; ?>">
											<div class="input-group">
												<input id="size2_<?=$row['p_id']; ?>" id2="<?=$row['p_id']; ?>"
												onclick="check_size(<?=$row['p_id']; ?>);" class="form-control px-2 input-check-size" 
												value="<?=$row3['size_name'];?> <?php if(empty($color_name)){}else{?>(<?=$color_name;?>)<?php } ?>" readonly>
												<div class="input-group-addon p-2 check-size-btn"> <i class="fa fa-bars"></i> </div>
											</div>
											
											<input type="hidden" id="size_<?=$row['p_id']; ?>" class="form_value" value="<?=$size_id; ?>,<?=$p_old_price;?>,<?=$p_current_price;?>,<?=$p_qty;?>,<?=$size_name;?>,<?=$row['p_id']; ?>,<?=$color_id; ?>,<?=$color_name; ?>,<?=$p_pv;?>" id2="<?=$row['p_id']; ?>" />
											<?php
											
                                                }
                                                $i++;
                                            }
                                            ?>
								<h6 class="product-price">
									<del><?php if($p_old_price!='' && $p_old_price!=$p_current_price){?><span class="regular-price"><?=$data['currency'];?><b id="price_o_<?=$row['p_id']; ?>"><?=$p_old_price; ?></b></span><?php } ?></del>
									<span><b id="price_c_<?=$row['p_id']; ?>"><?=$data['currency'];?><?=$p_current_price; ?></b> <b class="pv d-none">(<b id="p_pv2_<?=$row['p_id']; ?>"><?=$p_pv;?></b> PV)</b></span>
								</h6>
								<!--Product Size start-->
                                    <?php
                                                $count=0; 
                                                $query21 = $this->db->query("select * from tbl_product_size where p_id = $pid");
                                                foreach ($query21->result_array() as $row2) {
                                                    $primary_id=0; $count++; $primary_id = $row['p_id'].$row2['size_id'].$row2['color_id'];
                                                    ?>
                                                    <button class="product-wish wish wish2" id="wish_hide_A<?=$primary_id; ?>" onclick="add_to_wishlist(<?=$row['p_id'].','.$primary_id; ?>)"><i class="fas fa-heart"></i></button>
                                                <?php
                                                    if($row2['p_qty'] != 0){
                                                ?>
                                                
                                                    <div class="product-action" id2="yes1" id3="<?=$count;?>" id="hide_A<?=$primary_id; ?>" style="display:none">
                                                        <button class="action-minus" title="Quantity Minus" onclick="minus(<?=$row['p_id'].','.$primary_id; ?>)"><i class="icofont-minus"></i></button>
                                                        <input class="action-input" title="Quantity Number" readonly name="quantity" qty_id="<?=$l;?>" id="qty_<?=$primary_id; ?>" qty="<?=$row2['p_qty']; ?>" value="1">
                                                        <button class="action-plus" title="Quantity Plus" onclick="plus(<?=$row['p_id'].','.$primary_id; ?>)"><i class="icofont-plus"></i></button>
                                                    </div>
                                                    <input id="qty2_<?=$primary_id; ?>" qty="<?=$row2['p_qty']; ?>" type="hidden" value="1" />
                                                    <button class="product-add" title="Add to Cart" id2="no1" id3="<?=$count;?>" id="hide_B<?=$primary_id; ?>" onclick="add(<?=$row['p_id'].','.$primary_id; ?>)"><i class="fas fa-shopping-basket"></i><span>add to cart</span></button>
    										<?php
                                                    }
                                                    else if($row2['p_qty'] == 0 || $row2['p_qty'] < 0)
                                                    {
                                            ?>
                                                    <button class="product-add bg-warning" title="Out Of Stock" id2="no1" id3="<?=$count;?>" id="hide_B<?=$primary_id; ?>" onclick="sweetalert('warning','Out Of Stock')"><i class="fas fa-shopping-basket"></i><span>Out Of Stock</span></button>
    								            <?php
                                                    }
                                                }
                                                ?>
										<!--Product Size end-->
									</div>
								</div>
							</div>
							<?php }
                        } else {
                            ?>
                            <div class="item" loading="lazy">
								<div class="col-md-12 text-center"> <img src="<?=base_url('uploads/no_product_found.png');?>" class="img-fluid" /> </div>
							</div>
						<?php
                        }
                        ?>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<div class="section-btn-25"><a href="<?=base_url('featured');?>" class="btn btn-outline"><i class="fas fa-eye"></i><span>show more</span></a></div>
			</div>
		</div>
	</div>
</section>

<section class="d-none">
            <div class="container">
                <div class="row ">
                    <?php
        				$statement = $this->db->query("SELECT * FROM tbl_mid_category WHERE status_home=1 AND status=1");
        				$result = $statement->result_array();
        				foreach ($result as $row1) {
        					?>
        				<div class="col-md-12 col-12 col-lg-12 mb-3">			
                            <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('fa-chevron-up');">
                                    <div class="category-item2">
                                        <div class="row">
                                        <div class="col-md-4  col-sm-4 col-4 "><img class="d-block mx-auto w-auto" src="<?=base_url('uploads/shop/mid_category/'.$row1['mcat_pic']); ?>" alt="<?=$row1['mcat_name']; ?>"></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="fa fa-chevron-down"></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>

<!--<section class="section niche-part">
	<div class="container">
		<div class="row">
			<div class="col-lg-12">
				<div class="section-heading">
					<h2>Browse by Top Niche</h2>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-lg-12">
				<ul class="nav nav-tabs">
					<li><a href="#top-order" class="tab-link active" data-bs-toggle="tab"><i class="icofont-price"></i><span>top order</span></a></li>
					<li><a href="#top-rate" class="tab-link" data-bs-toggle="tab"><i class="icofont-star"></i><span>top rating</span></a></li>
					<li><a href="#top-disc" class="tab-link" data-bs-toggle="tab"><i class="icofont-sale-discount"></i><span>top discount</span></a></li>
				</ul>
			</div>
		</div>
		<div class="tab-pane active" id="top-order">
			<div class="row row-cols-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5">
				<div class="col">
					<div class="product-card">
						<div class="product-media">
							<div class="product-label"><label class="label-text order">314</label></div>
							<button class="product-wish wish"><i class="fas fa-heart"></i></button><a class="product-image" href="product-video.php"><img src="<?=base_url('site_assets/');?>images/product/01.jpg" alt="product"></a>
							<div class="product-widget"><a title="Product Compare" href="compare.php" class="fas fa-random"></a><a title="Product Video" href="https://youtu.be/9xzcVxSBbG8" class="venobox fas fa-play" data-autoplay="true" data-vbtype="video"></a><a title="Product View" href="#" class="fas fa-eye" data-bs-toggle="modal" data-bs-target="#product-view"></a></div>
						</div>
						<div class="product-content">
							<div class="product-rating"><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="icofont-star"></i><a href="product-video.php">(3)</a></div>
							<h6 class="product-name"><a href="product-video.php">fresh green chilis</a>
							</h6>
							<h6 class="product-price"><del>$34</del><span>$28<small>/piece</small></span>
							</h6>
							<button class="product-add" title="Add to Cart"><i class="fas fa-shopping-basket"></i><span>add</span></button>
							<div class="product-action"><button class="action-minus" title="Quantity Minus"><i class="icofont-minus"></i></button><input class="action-input" title="Quantity Number" type="text" name="quantity" value="1"><button class="action-plus" title="Quantity Plus"><i class="icofont-plus"></i></button></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="tab-pane" id="top-rate">
			<div class="row row-cols-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5">
				<div class="col">
					<div class="product-card">
						<div class="product-media">
							<div class="product-label"><label class="label-text rate">4.8</label></div>
							<button class="product-wish wish"><i class="fas fa-heart"></i></button><a class="product-image" href="product-video.php"><img src="<?=base_url('site_assets/');?>images/product/11.jpg" alt="product"></a>
							<div class="product-widget"><a title="Product Compare" href="compare.php" class="fas fa-random"></a><a title="Product Video" href="https://youtu.be/9xzcVxSBbG8" class="venobox fas fa-play" data-autoplay="true" data-vbtype="video"></a><a title="Product View" href="#" class="fas fa-eye" data-bs-toggle="modal" data-bs-target="#product-view"></a></div>
						</div>
						<div class="product-content">
							<div class="product-rating"><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="icofont-star"></i><a href="product-video.php">(3)</a></div>
							<h6 class="product-name"><a href="product-video.php">fresh green chilis</a>
							</h6>
							<h6 class="product-price"><del>$34</del><span>$28<small>/piece</small></span>
							</h6>
							<button class="product-add" title="Add to Cart"><i class="fas fa-shopping-basket"></i><span>add</span></button>
							<div class="product-action"><button class="action-minus" title="Quantity Minus"><i class="icofont-minus"></i></button><input class="action-input" title="Quantity Number" type="text" name="quantity" value="1"><button class="action-plus" title="Quantity Plus"><i class="icofont-plus"></i></button></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="tab-pane" id="top-disc">
			<div class="row row-cols-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5">
				<div class="col">
					<div class="product-card">
						<div class="product-media">
							<div class="product-label"><label class="label-text off">-10%</label></div>
							<button class="product-wish wish"><i class="fas fa-heart"></i></button><a class="product-image" href="product-video.php"><img src="<?=base_url('site_assets/');?>images/product/06.jpg" alt="product"></a>
							<div class="product-widget"><a title="Product Compare" href="compare.php" class="fas fa-random"></a><a title="Product Video" href="https://youtu.be/9xzcVxSBbG8" class="venobox fas fa-play" data-autoplay="true" data-vbtype="video"></a><a title="Product View" href="#" class="fas fa-eye" data-bs-toggle="modal" data-bs-target="#product-view"></a></div>
						</div>
						<div class="product-content">
							<div class="product-rating"><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="active icofont-star"></i><i class="icofont-star"></i><a href="product-video.php">(3)</a></div>
							<h6 class="product-name"><a href="product-video.php">fresh green chilis</a>
							</h6>
							<h6 class="product-price"><del>$34</del><span>$28<small>/piece</small></span>
							</h6>
							<button class="product-add" title="Add to Cart"><i class="fas fa-shopping-basket"></i><span>add</span></button>
							<div class="product-action"><button class="action-minus" title="Quantity Minus"><i class="icofont-minus"></i></button><input class="action-input" title="Quantity Number" type="text" name="quantity" value="1"><button class="action-plus" title="Quantity Plus"><i class="icofont-plus"></i></button></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-lg-12">
				<div class="section-btn-25"><a href="#<?=base_url('trending');?>" class="btn btn-outline"><i class="fas fa-eye"></i><span>show more</span></a></div>
			</div>
		</div>
	</div>
</section>-->

<!--<div class="section promo-part">
	<div class="container">
		<div class="row">
		    <?php
                    $u=0;
                    $query = $this->db->query("SELECT * FROM tbl_ad_slider ORDER BY RAND() limit 2");
                    foreach ($query->result_array() as $row) {
        		?>
			<div class="col-sm-12 col-md-6 col-lg-6 px-xl-3 <?php if($u==0){echo 'd-none d-lg-block d-md-block d-sm-block';}?>">
				<div class="promo-img"><a href="<?=$row['link']; ?>"><img src="<?= base_url('uploads/shop/ad_slider/'.$row['img']); ?>" class="w-100 alt="<?=$row['title']; ?>"></a></div>
			</div>
			<?php
			        $u++;
                        }
			?>
		</div>
	</div>
</div>-->

<!--<section class="section brand-part">
	<div class="container">
		<div class="row">
			<div class="col-12">
				<div class="section-heading">
					<h2>shop by brands</h2>
				</div>
			</div>
		</div>
		<div class="brand-slider slider-arrow">
			<div class="brand-wrap">
				<div class="brand-media">
					<img src="<?=base_url('site_assets/');?>images/brand/01.jpg" alt="brand">
					<div class="brand-overlay"><a href="#"><i class="fas fa-link"></i></a></div>
				</div>
				<div class="brand-meta">
					<h4>natural organe</h4>
					<p>(45 items)</p>
				</div>
			</div>
		</div>
	</div>
</section>-->

<style>
  .scroll-container {
    overflow: hidden;
    white-space: nowrap;
    direction: rtl;
    padding: 20px 0;
    background: #f1f1f1;
  }

  .scroll-inner {
    display: inline-flex;
    white-space: nowrap;
    animation: scrollLeft 30s linear infinite;
    min-width: 100%;
    align-items: center;
  }

  @keyframes scrollLeft {
    0% {
      transform: translateX(100%);
    }
    100% {
      transform: translateX(-100%);
    }
  }

  .achiever-card {
    display: inline-block;
    margin: 0 15px;
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 12px;
    min-width: 200px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s ease;
  }

  .achiever-card:hover {
    transform: scale(1.05);
  }

  .achiever-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    margin: auto;
    border: 2px solid #007bff;
  }

  .achiever-name {
    font-weight: 600;
    margin-top: 10px;
    font-size: 1rem;
    color: #333;
  }

  .achiever-id {
    font-size: 0.85rem;
    color: #666;
  }
</style>

<div class="container mt-4">
  <h4 class="text-center mb-4 fw-bold">Our Proud Achievers</h4>

  <div class="scroll-container">
    <div class="scroll-inner">
        
        <?php
        
        $this->db->where('status',1);
		$Achievers = $this->db->get('tbl_photo1')->result_array();
		
        ?>

<?php foreach($Achievers as $r){ ?>
      <!-- Reusable Achiever Card -->
      <div class="achiever-card text-center">
        <div class="row">
          <div class="col-12">
            <img src="<?= $r['photo'] ?>" class="achiever-photo mb-2" alt="Achiever">
          </div>
          <div class="col-12">
            <div class="achiever-name"><?= $r['title'] ?></div>
            <div class="achiever-id">ID: <?= $r['link'] ?></div>
          </div>
        </div>
      </div>

 <?php } ?>    

      <!-- Repeat more cards if needed -->
      
    </div>
  </div>
</div>

<?php
	include('footer.php');
	?>
	 <?php $ddata ='?><script>localStorage.getItem("products");</script><?php ';?>
	 <?php
	 print_r($ddata);
	?>