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

[Back to List]
<?php
error_reporting(0);
include "includes/main-action.php";
$_REQUEST['command']="add";
$listAdd = ''; 
if(!empty($_SESSION['user_id']))$link = 'proceedtopay';else $link = 'login';
$obj=new admin_main();
//add product to cart
if($_REQUEST['command']=='add' && $_REQUEST['productid']>0){
	if($_POST['quantity']>$_POST['maxStock'])echo "out"; else{
	  $psizeIs=end(explode("*",$_POST['pcolor']));
	   addtocart($_REQUEST['productid'],$_REQUEST['quantity'],$psizeIs,$_REQUEST['pcolor'],'');
	   if(count($_SESSION['cart'])>3)$listCss='height: 275px;overflow-y: scroll;';
	   
	   $listAdd = '<div class="shopping_cart hidden-xs hidden-sm hidden-md" id="addlist">
          <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"> <span class="icon-c"> <i class="fa fa-shopping-bag"></i> </span>
              <div class="shopcart-inner"> <span class="total-shopping-cart cart-total-full"> <span class="items_cart">'.count($_SESSION['cart']).'</span><span class="items_cart2"> item(s)</span> </span> </div>
            </div>
            </a>
			<ul class="dropdown-menu pull-right shoppingcart-box" role="menu">
	              <li><form name="form3" method="post" style="'.$listCss.'">
                  <table class="table table-striped">
                    <tbody>
					<input type="hidden" name="pid" />
                        <input type="hidden" name="command1" />';
						
                      
			$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);
			$prc_exp = explode("*M*",$c);
		    $price = $prc_exp[0]; 
		    $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'];
			
			$listAdd .='<tr>
                        <td class="text-center" style="width:70px"><a href="'.$url.'product.php?pid='.$pid.'">
						 <img src="'.$url.'image/product/'.$imgpathis[0].'" style="width:50px" alt="" title="'.$rtt['name'].'" class="preview"> </a> </td>
                        <td class="text-left"><a class="cart_product_name" href="'.$url.'product.php?pid='.$pid.'">'.$rtt['name'].'</a> </td>
                        <td><input type="hidden" name="totalStock'.$pid.'" value="'.$totalStock.'" />
                          <input type="number" name="product'.$pid.'" value="'.$q.'" size="1"  max="10" min="1"  style="padding: 5px;width: 40px;font-weight: bold;" onChange="update_cart2()" /></td>
                        <td class="text-center"><i class="fa fa-rupee"></i> '.number_format($price,2).' X '.$q.'</td>
                      </tr>';
                    }//close of for loop
					
              $listAdd .='<tr>
                        <td colspan="4"><b>Total Amount:</b> Rs.'.$total4.'</td>
                      </tr>
                    </tbody>
                  </table>
                </form>
			 </li>
			<p class="text-right"> <a class="btn view-cart" href="'.$url.'shoppingcart.php"><i class="fa fa-shopping-cart"></i> View Cart</a>&nbsp;&nbsp;&nbsp; <a class="btn btn-mega checkout-cart" href="'.$url.$link.'.php"><i class="fa fa-share"></i> Checkout</a> </p>
			</ul>
		  </div>
        </div>';
				
		echo $listAdd;		
	       }//close of else
		}//close of if
?>