System: Windows NT WINDOWS18 10.0 build 17763 (Windows Server 2016) AMD64 | User: IWPD_3544(appclien)

Path: D:\Inetpub\vhosts\appclients.in\fruits-vegitables.nmvm.org\includes

[Back to List]
<?php
   error_reporting(0);
   // add product to cart
   if($_REQUEST['command1']=='delete' && $_REQUEST['pid']>0){
   	remove_product($_REQUEST['pid']);
   }
   else if($_REQUEST['command1']=='clear'){
   	unset($_SESSION['cart']);
   }
   else if($_REQUEST['command1']=='update'){
   	$max=count($_SESSION['cart']);
   	for($i=0;$i<$max;$i++){
   	  $pid=$_SESSION['cart'][$i]['productid'];
   	  $totalStock=$_REQUEST["totalStock$pid"];
   	  $prodQty=$_REQUEST["product$pid"];
   	  /*
   	  echo "<script>alert('".$prodQty."')</script>";
   	  echo "<script>alert('".$totalStock."')</script>";
   	  */
   	  if($prodQty<=$totalStock){
   		//$imgID=$_SESSION['cart'][$i]['imgID'];
   		$q=intval($_REQUEST['product'.$pid]);
   		if($q>0 && $q<=999){
   			$_SESSION['cart'][$i]['qty']=$q;
   		}
   		}else{
   		 echo "<script>alert('Out of stock')</script>";
   		}
   	}
   }
   
   //search 
   if(isset($_POST['submitsearch1'])){
   $searchKey = addslashes(urlencode($_POST['searchkey']));
   echo "<script>window.location='searchresult.php?search=$searchKey'</script>";
   }
   if(isset($_POST['submitsearch2'])){
   $searchKey = addslashes(urlencode($_POST['searchkey']));
   echo "<script>window.location='searchresult.php?search=$searchKey'</script>";
   }
  //sel menu
  $sel_nav = $obj->select_all("menu", "where status='Active' order by menu_id"); 
   ?>
<script language="javascript">
   function del_f(pid){
   	if(confirm('Do you really mean to delete this item')){
   		document.form3.pid.value=pid;
   		document.form3.command1.value='delete';
   		document.form3.submit();
   	}
   }
   
   function update_cart2(){
   	document.form3.command1.value='update';
   	document.form3.submit();
   }
   
      // Modern Search Overlay Logic
      function openSearch() {
          const overlay = document.getElementById("searchOverlay");
          overlay.style.display = "flex"; // Changed from block for centering
          setTimeout(() => {
              overlay.classList.add("active");
              document.getElementById("searchInput").focus();
          }, 10);
      }
   
      function closeSearch() {
          const overlay = document.getElementById("searchOverlay");
          overlay.classList.remove("active");
          setTimeout(() => {
              overlay.style.display = "none";
          }, 400); // Wait for transition
      }
   
      // Close on Escape key
      document.onkeydown = function(evt) {
          evt = evt || window.event;
          if (evt.keyCode == 27) {
              closeSearch();
          }
      };
</script>
<script>
   //check pin code availablity
   function checkPin(){
   var str=document.getElementById('pincode').value;
   if(str!=''){
    if (window.XMLHttpRequest)
     {// code for IE7+, Firefox, Chrome, Opera, Safari
     xmlhttp=new XMLHttpRequest();
     }
   else
     {// code for IE6, IE5
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
   xmlhttp.onreadystatechange=function()
     {
     if (xmlhttp.readyState==4 && xmlhttp.status==200)
       {
   	 if(xmlhttp.responseText==1){
   	   //alert('Deliver available product will be deliver within 3-5 working days.');
   		 document.getElementById("txtHint").innerHTML='<b style="color:#e47325">Deliver available product will be deliver within 3-5  hours.</b>';
   	  }else{
   	   //alert('Not Available');
   		  document.getElementById("txtHint").innerHTML='<b style="color:red">Not Available</b>';
   	  }
       }
     }
   xmlhttp.open("GET","../checkpin.php?q="+str,true);
   xmlhttp.send();
   }
   }
</script>
<style>
   /* Inline critical styles for alignment if CSS cache is an issue */
   .header-middle .row {
   display: flex; /* Modern flexible alignment */
   align-items: center;
   flex-wrap: wrap; 
   }
   .middle2 > div {
   text-align: center; /* Center the menu */
   }
   .telephone ul {
   display: flex;
   align-items: center;
   justify-content: flex-end; /* Align right side items */
   gap:0px;
   margin-bottom: 0;
   }
   .telephone ul li {
   display: inline-flex;
   align-items: center;
   }
   /* Ensure cart dropdown doesn't get hidden */
   .dropdown-menu {
   z-index: 10001; 
   }
   /* PREMIUM SEARCH OVERLAY STYLES */
   .overlay {
   height: 100%;
   width: 100%;
   display: none; /* Hidden by default */
   position: fixed;
   z-index: 99999;
   top: 0;
   left: 0;
   background-color: rgba(0,0,0, 0.85); /* fallback */
   background: radial-gradient(circle, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.95) 100%);
   backdrop-filter: blur(10px); /* Glassmorphism */
   justify-content: center;
   align-items: center;
   opacity: 0;
   transition: opacity 0.4s ease;
   }
   .overlay.active {
   opacity: 1;
   }
   .overlay .closebtn {
   position: absolute;
   top: 30px;
   right: 45px;
   font-size: 60px;
   cursor: pointer;
   color: #fff;
   transition: transform 0.3s ease, color 0.3s ease;
   }
   .overlay .closebtn:hover {
   color: #f1f1f1;
   transform: rotate(90deg);
   }
   .overlay-content {
   width: 100%;
   max-width: 800px;
   padding: 0 20px;
   transform: translateY(30px);
   transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
   }
   .overlay.active .overlay-content {
   transform: translateY(0);
   }
   .overlay-content form {
   position: relative;
   display: flex;
   align-items: center;
   border-bottom: 2px solid rgba(255,255,255,0.2);
   padding-bottom: 10px;
   transition: border-bottom-color 0.3s ease;
   }
   .overlay-content form:focus-within {
   border-bottom-color: #f39c12; /* Brand orange color */
   }
   .overlay-content input[type=text] {
   padding: 15px 0;
   font-size: 36px;
   border: none;
   float: left;
   width: 100%;
   background: transparent;
   color: white;
   font-family: 'Outfit', sans-serif;
   outline: none;
   font-weight: 300;
   }
   .overlay-content input[type=text]::placeholder {
   color: rgba(255,255,255,0.4);
   font-style: italic;
   }
   .overlay-content button {
   background: transparent;
   font-size: 32px;
   border: none;
   cursor: pointer;
   color: white;
   padding: 0 15px;
   transition: color 0.3s ease, transform 0.3s ease;
   }
   .overlay-content button:hover {
   color: #f39c12;
   transform: scale(1.1);
   }
   /* Animations */
   @keyframes fadeIn {
   from { opacity: 0; }
   to { opacity: 1; }
   }
   .middle2 ul li a {
   font-size: 17px;
   font-weight: 600;
   font-family: 'Merriweather', serif;
   }
   .middle2 ul li a:hover i {
   color:red;
   }
</style>
<div class="header-middle" style="padding:10px 0;">
   <!-- Added padding for breathing room -->
   <div class="container">
      <div class="row">
         <!-- Logo (Col 2) -->
         <div class="navbar-logo hidden-xs hidden-sm hidden-md col-lg-3 col-md-3 col-sm-12 col-xs-5">
            <div style="display:flex;align-items: center;">
               <div class="logo"> 
                  <a href="<?php echo $url ?>"> <img src="<?php echo $url ?>image/catalog/logocart.png" style="width: 120px;" /> </a>
               </div>
               <div class="location" style="display: flex;
                  align-items: center;
                  margin-left: 15px;
                  padding: 4px 20px;
                  border: 1px solid #787878;
                  border-radius: 6px;">
                  <div class="location_icon"><i style="color:#777;" class="fa fa-map-marker fa-2x"></i></div>
                  <div class="location_name" style="margin-left:10px;">
                     <p style="color:#777; margin-bottom:0px;">Location</p>
                     <h3>Gurgoan</h3>
                  </div>
               </div>
            </div>
         </div>
         <!-- //end Logo -->
         <!-- Menu (Col 5) - Centered -->
         <div class="middle2 hidden-xs hidden-sm hidden-md col-lg-6 col-md-6 col-sm-6 col-xs-6">
            <div>
               <ul class="list-unstyled list-inline" style="margin-bottom:0;">
                  <li><a href="index.php">Home</a></li>
                  <li><a href="about-us.php">About Us</a></li>
                  <?php while($data=mysqli_fetch_array($sel_nav)){?>
                   <li><a href="products.php?catid=<?php echo $data['menu_id']?>"><?php echo $data['menu']?></a></li>
                  <?php }?>
                  <li><a href="contact-us.php">Contact Us</a></li>
               </ul>
            </div>
         </div>
         <!-- Right Icons (Col 5) - Aligned Right -->
         <div class="middle3 hidden-xs hidden-sm hidden-md col-lg-3 col-md-3 col-sm-6 col-xs-7">
            <div class="telephone">
               <!-- Remove left margin, use Flexbox -->
               <ul>
                  <!-- Search Trigger -->
                  <li class="search-icon"><a href="javascript:void(0);" onclick="openSearch()" ><i class="fa fa-search fa-2x"></i></a></li>
                  <!-- User Sign In / Profile -->
                  <?php if(empty($_SESSION['user_id']) && !isset($_SESSION['user_id'])){?>
                  <li style="font-size: 14px;">
                     <a href="<?php echo $url?>login.php"><i class="fa fa-user-circle fa-2x"></i> Sign-in </a> | <a href="<?php echo $url?>register.php">Register</a>
                  </li>
                  <?php }else{ ?>
                  <li>
                     <div class="dropdown">
                        <button class="dropbtn" style="background-color: black;font-size: 20px;">
                        <?php $expName = explode(" ",$_SESSION['userName']);  echo ucfirst($expName[0]);?></button>
                        <div class="dropdown-content"> <a href="<?php echo $url?>profile-details.php">My Profile</a> <a href="<?php echo $url?>edit-profile.php">Edit Profile</a> 
                           <a href="<?php echo $url?>myorder.php">My Order</a> 
                           <a href="<?php echo $url?>changePass.php">Change&nbsp;Password</a> 
                           <a href="<?php echo $url?>logout.php">Logout</a> 
                        </div>
                     </div>
                  </li>
                  <?php
                     }?>
                  <!-- Cart Integrated Here -->
                  <li>
                     <div id="addlistdata"></div>
                     <div class="shopping_cart hidden-xs hidden-sm hidden-md" id="addlist" style="display: inline-block;">
                        <div id="cart" class="btn-shopping-cart">
                           <a data-loading-text="Loading... " class="btn-group top_cart dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
                              <div class="shopcart" style="margin-left:0;">
                                 <i class="fa fa-shopping-bag fa-2x"></i> 
                                 <div class="shopcart-inner"> <span class="total-shopping-cart cart-total-full"> <span class="items_cart">
                                    <?php if(isset($_SESSION['cart']))echo count($_SESSION['cart']);else echo 0?></span><span class="items_cart2"> item(s)</span> </span> 
                                 </div>
                              </div>
                           </a>
                           <ul class="dropdown-menu pull-right shoppingcart-box" role="menu">
                              <?php if(!empty($_SESSION['cart']) && isset($_SESSION['cart'])){?>
                              <li>
                                 <form name="form3" method="post" <?php if(count($_SESSION['cart'])>3 && isset($_SESSION['cart'])){?>style="height: 275px;overflow-y: scroll;" <?php }?>>
                                    <table class="table table-striped">
                                       <tbody>
                                          <tr>
                                             <input type="hidden" name="pid" />
                                             <input type="hidden" name="command1" />
                                             <?php
                                                $total4=0; 						   
                                                $max=count($_SESSION['cart']);
                                                for($i=0;$i<$max;$i++){
                                                $pid=$_SESSION['cart'][$i]['productid'];
                                                $q=$_SESSION['cart'][$i]['qty'];
                                                $s=$_SESSION['cart'][$i]['psize'];
                                                $c=$_SESSION['cart'][$i]['pcolor'];
                                                $price=get_price($pid);
                                                $sql=mysqli_query($con,"select * from product where id='$pid'");
                                                $rtt = mysqli_fetch_array($sql);
                                                $imgpathis=json_decode($rtt['img']);
                                                $total4=$total4+$price*$q;
                                                $totalStock=$rtt['stock'];
                                                ?>
                                             <td class="text-center" style="width:70px"><a href="<?php echo $url?>product.php?pid=<?php echo $pid ?>"> <img src="<?php echo $url?>image/product/<?php echo $imgpathis[0]; ?>" style="width:50px" alt="" title="<?php echo $rtt['name'] ?>" class="preview"> </a> </td>
                                             <td class="text-left"><a class="cart_product_name" href="<?php echo $url?>product.php?pid=<?php echo $pid ?>"><?php echo $rtt['name'] ?></a> </td>
                                             <td><input type="hidden" name="totalStock<?php echo $pid?>" value="<?php echo $totalStock?>" />
                                                <input type="number" name="product<?php echo $pid?>" value="<?php echo $q ?>" size="1"  max="10" min="1"  style="padding: 5px;width: 40px;font-weight: bold;" onChange="update_cart2()" />
                                             </td>
                                             <td class="text-center" style="width: 90px;"><i class="fa fa-rupee"></i> <?php echo number_format($price)?> X <?php echo $q?></td>
                                          </tr>
                                          <?php } ?>
                                          <tr>
                                             <td colspan="4"><b>Total Amount:</b> Rs. <?php echo $total4?></td>
                                          </tr>
                                       </tbody>
                                    </table>
                                 </form>
                              </li>
                              <p class="text-right"> <a class="btn view-cart" href="<?php echo $url?>shoppingcart.php"><i class="fa fa-shopping-cart"></i> View Cart</a>&nbsp;&nbsp;&nbsp; <a class="btn btn-mega checkout-cart" href="<?php echo $url?><?php if(!empty($_SESSION['user_id']) && isset($_SESSION['user_id']))echo 'proceedtopay';else echo 'login'?>.php"><i class="fa fa-share"></i> Checkout</a> </p>
                              <?php }else{
                                 echo '<div style="text-align:center;padding: 20px;">
                                 <p>There are no items in your cart</p>
                                 <div class="buttons">
                                   <a href="'.$url.'" class="btn btn-primary">Continue Shopping</a>
                                 </div>
                                 </div>';
                                 }?>
                           </ul>
                        </div>
                     </div>
                  </li>
               </ul>
            </div>
         </div>
      </div>
   </div>
</div>
<!-- Premium Search Overlay -->
<div id="searchOverlay" class="overlay">
   <span class="closebtn" onclick="closeSearch()" title="Close Overlay">&times;</span>
   <div class="overlay-content">
      <form method="post" action="searchresult.php">
         <input type="text" placeholder="Type to search..." name="searchkey" id="searchInput" autocomplete="off">
         <button type="submit" name="submitsearch1"><i class="fa fa-search"></i></button>
         <input type="hidden" name="route" value="product/search" />
      </form>
   </div>
</div>